Skip to content

Commit

Permalink
chore: fix yet another common flake
Browse files Browse the repository at this point in the history
as we try to install the same services multiple times, there are race
conditions.

also there's a common error when trying to look at the plan. therefore we now
install confluent-kafka right in the first step, so it has some time to spin up
before the test.
  • Loading branch information
pierrebeitz committed Aug 11, 2020
1 parent 03b4616 commit 9afaf6f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 95 deletions.
2 changes: 1 addition & 1 deletion system-tests/services/_scripts/teardown
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

# Remove the service group for the test
dcos marathon group remove --force /$TEST_UUID
dcos marathon group remove --force /
8 changes: 2 additions & 6 deletions system-tests/universe/_scripts/teardown
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@ from subprocess import check_output
packages = json.loads(check_output('dcos package list --json', shell=True).decode('utf-8'))
for package in packages:
for appId in package['apps']:
if appId.startswith(("/%s" % os.environ['TEST_UUID'])):
print("Removing package %s" % appId)
check_output('dcos package uninstall %s --app-id=%s --yes' % (package['name'], appId), shell=True)
elif appId == '/confluent-kafka' or appId == '/bitbucket':
print("Removing package %s" % appId)
check_output('dcos package uninstall %s --app-id=%s --yes' % (package['name'], appId), shell=True)
print("Removing package %s" % appId)
check_output('dcos package uninstall %s --app-id=%s --yes' % (package['name'], appId), shell=True)
122 changes: 34 additions & 88 deletions system-tests/universe/test-universe-cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ describe("Universe", () => {
cy.visitUrl("catalog/packages");
});

it("installs a certified package", () => {
// we run this first, so the plan-check down below does not need to wait for so long.
it("uses advanced install to deploy a certified package", () => {
const packageName = "confluent-kafka";
const serviceName = `${Cypress.env("TEST_UUID")}-${packageName}`;

// Click 'Find a the kafka package'
cy.contains(packageName).click();
Expand All @@ -16,21 +18,26 @@ describe("Universe", () => {
// Click the Review & Run button
cy.contains("Review & Run").click();

// Move to the review screen
cy.contains("Review & Run").click();
// Click Edit Config button
cy.contains("Edit Config").click();

// Click the Run Service button
cy.contains("Run Service").click();
// Find name input
cy.get(".modal input[name=name]").retype(serviceName);

// Wait for the new service to deploy
cy.get(".modal").contains("Review & Run").click();
cy.get(".modal").contains("Run Service").click();
cy.get(".modal.modal-small").contains("Open Service").click();

// Go to the root services page
cy.visitUrl("services/overview");

// Check that it appears in the service list
cy.get(".page-body-content .service-table").contains(packageName);
cy.get(".page-body-content .service-table").contains(serviceName);
});

it("fails to install a package with the same name", () => {
const packageName = "confluent-kafka";
it("installs a certified package", () => {
const packageName = "chronos";

// Click 'Find a the kafka package'
cy.contains(packageName).click();
Expand All @@ -40,11 +47,18 @@ describe("Universe", () => {

// Click the Review & Run button
cy.contains("Review & Run").click();

// Move to the review screen
cy.contains("Review & Run").click();
cy.contains("Run Service").click();
// Check that it appears in the service list
cy.visitUrl("services/overview");
cy.get(".page-body-content .service-table").contains(packageName);

// Click the Run Service button
// Check that we cannot deploy with the same name again.
cy.visitUrl("catalog/packages");
cy.contains("Certified");
cy.contains(packageName).click();
cy.contains("Review & Run").click();
cy.contains("Review & Run").click();
cy.contains("Run Service").click();

// Should give error that package already installed
Expand Down Expand Up @@ -80,91 +94,15 @@ describe("Universe", () => {
// Check that it appears in the service list
cy.get(".page-body-content .service-table").contains("bitbucket");
});

it("uses advanced install to deploy a certified package", () => {
const packageName = "confluent-kafka";
const serviceName = `${Cypress.env("TEST_UUID")}-${packageName}`;

// Click 'Find a the kafka package'
cy.contains(packageName).click();

// Check that this package is certified
cy.contains("Certified");

// Click the Review & Run button
cy.contains("Review & Run").click();

// Click Edit Config button
cy.contains("Edit Config").click();

// Find name input
cy.get(".modal input[name=name]").retype(serviceName);

// Wait for the new service to deploy
cy.get(".modal").contains("Review & Run").click();
cy.get(".modal").contains("Run Service").click();
cy.get(".modal.modal-small").contains("Open Service").click();

// Go to the root services page
cy.visitUrl("services/overview");

// Check that it appears in the service list
cy.get(".page-body-content .service-table").contains(serviceName);
});

it("uses advanced install to deploy a community package", () => {
const packageName = "bitbucket";
const serviceName = `${Cypress.env("TEST_UUID")}-${packageName}`;

cy.get("button").contains("Community").click();

cy.contains(packageName).click();

// Check that this package is certified
cy.contains("Community");

cy.contains("Review & Run").click();

// Click the Continue button
cy.get(".button-primary").contains("Continue").click();

// Click Edit Config button
cy.contains("Edit Config").click();

// Find name input
cy.get(".modal input[name=name]").retype(serviceName);

// Wait for the new service to deploy
cy.get(".modal").contains("Review & Run").click();
cy.get(".modal").contains("Run Service").click();
cy.get(".modal.modal-small").contains("Open Service").click();

// Go to the root services page
cy.visitUrl("services/overview");

// Check that it appears in the service list
cy.get(".page-body-content .service-table").contains(serviceName);
});
});

describe("on services/overview", () => {
beforeEach(() => {
cy.visitUrl("services/overview");
});

it("plan is displayed", () => {
const packageName = "confluent-kafka";
// Check that it appears in the service list
cy.get(".page-body-content .service-table").contains(packageName).click();

cy.get(".page-header-navigation-tabs").contains("Plans").click();

cy.contains("broker (serial)");
});

it("deletes an already installed package", () => {
const packageName = "bitbucket";
const serviceName = `${Cypress.env("TEST_UUID")}-${packageName}`;
const serviceName = "bitbucket";

// Click on the name of the package to delete
cy.get(".page-body-content .service-table")
Expand All @@ -191,5 +129,13 @@ describe("Universe", () => {
.contains(serviceName)
.should("not.exist");
});

it("plan is displayed", () => {
const packageName = "confluent-kafka";
// Check that it appears in the service list
cy.get(".page-body-content .service-table").contains(packageName).click();
cy.get(".page-header-navigation-tabs").contains("Plans").click();
cy.contains("broker (serial)");
});
});
});

0 comments on commit 9afaf6f

Please sign in to comment.