Skip to content

Commit

Permalink
Improves #1644 - Add some integration tests for /v2/eventSubscription…
Browse files Browse the repository at this point in the history
…s endpoints.
  • Loading branch information
gkleiman committed Jul 2, 2015
1 parent aab10ab commit 60dc7a7
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package mesosphere.marathon.integration

import mesosphere.marathon.integration.setup.{ IntegrationFunSuite, SingleMarathonIntegrationTest }
import org.scalatest._

class EventSubscribersIntegrationTest
extends IntegrationFunSuite
with SingleMarathonIntegrationTest
with Matchers
with BeforeAndAfter
with GivenWhenThen {

before(cleanUp())

test("adding an event subscriber") {
When("an event subscriber is added")
marathon.subscribe("http://foobar.com:1337").code should be(200)

Then("a notification should be sent to all the subscribers")
waitForEvent("subscribe_event").info should contain("callbackUrl" -> "http://foobar.com:1337")

And("the subscriber should show up in the list of subscribers")
marathon.listSubscribers.value.urls should contain("http://foobar.com:1337")

// Cleanup
marathon.unsubscribe("http://foobar.com:1337")
}

test("removing an event subscriber") {
When("an event subscriber is removed")
marathon.subscribe("http://foobar.com:1337").code should be(200)
marathon.listSubscribers.value.urls should contain("http://foobar.com:1337")
marathon.unsubscribe("http://foobar.com:1337").code should be(200)

Then("a notification should be sent to all the subscribers")
waitForEvent("unsubscribe_event").info should contain("callbackUrl" -> "http://foobar.com:1337")

And("the subscriber should not show up in the list of subscribers")
marathon.listSubscribers.value.urls shouldNot contain("http://foobar.com:1337")
}
}

0 comments on commit 60dc7a7

Please sign in to comment.