Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test for missing API params #107

Merged
merged 9 commits into from Jun 17, 2014
Merged

Added test for missing API params #107

merged 9 commits into from Jun 17, 2014

Conversation

themue
Copy link
Contributor

@themue themue commented Jun 16, 2014

Test has been written to check for lp:1152393, but that has been an already fixed duplicate. We still add this little test to explicitely show that the API handles missing params well without closing the websocket.

Frank Mueller added 8 commits June 12, 2014 11:42
…rams

# By Ian Booth
# Via Ian Booth (1) and Juju bot (1)
* 'master' of https://github.com/juju/juju:
  Tweak hpcloud boilerplate to turn floating-ip and remove az from example region
…rams

# By Dave Cheney (6) and others
# Via Juju bot (7) and others
* 'master' of https://github.com/juju/juju:
  Add additional test
  Make tests easier to follow
  We shouldn't attempt to UTC a zero time.
  provider/azure: don't fail Destroy if AG/vnet can't be destroyed
  Add ResourceCatalog implementation
  Close the state connection, and run the tests.
  Handle constrained AZs
  fixups after merge from trunk
  update to latest juju/names
  Bug #1328716: Clean up CONTRIBUTING a bit.
  state/presence: fixing issues from review
  presencer: make the presencer interface official
  state/machine: check IsManager and only Sync presence watcher
  state/machine: StartSync in SetAgentPresence
  state/machine: use WaitAgentPresence, rename AgentAlive
  Final tweak
  Update for juju/names part 3
  wip
  Introduce Parse{Unit,Service,Machine}
c.Assert(err, gc.IsNil)

// Have to wait until root is registered.
<-s.ready
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this structure certainly makes me wonder if how the handler is defined is correct.
Looking at the code state/apiserver/apiserver.go I think the trick is that you have to call Serve() before you call Start(). That way there isn't anything responding on the websocket before you have a service that you are serving.
So probably you can remove the channel checks and just restructure your setup func as:
conn.Serve(&DispatchRoot(), nil)
conn.Start()

Certainly if you were actually using a real HTTP website, you would never have that channel to be able to indicate "ok, you've connected to my website, but give me 20ms to actually have the connection ready for you".

@jameinel
Copy link
Member

I think if we tweak the ordering of Start() and Serve() so that we don't have to have the separate channel to indicate you can actually make requests, then LGTM.

@themue
Copy link
Contributor Author

themue commented Jun 17, 2014

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jun 17, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot
Copy link
Collaborator

jujubot commented Jun 17, 2014

Build failed: Merging failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/180

@themue
Copy link
Contributor Author

themue commented Jun 17, 2014

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jun 17, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

jujubot added a commit that referenced this pull request Jun 17, 2014
Added test for missing API params

Test has been written to check for lp:1152393, but that has been an already fixed duplicate. We still add this little test to explicitely show that the API handles missing params well without closing the websocket.
@jujubot jujubot merged commit 75b6714 into juju:master Jun 17, 2014
@themue themue deleted the fix-api-params branch June 17, 2014 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants