-
Notifications
You must be signed in to change notification settings - Fork 846
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves #1644 - Add some integration tests for /v2/eventSubscription…
…s endpoints.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/test/scala/mesosphere/marathon/integration/EventSubscribersIntegrationTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} |