Skip to content

Commit

Permalink
Add test case to EnvironmentControllerFT
Browse files Browse the repository at this point in the history
  • Loading branch information
akolod committed May 21, 2021
1 parent e9543b5 commit 94745ac
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ class EnvironmentControllerFT extends PostgresDatabaseSpecification {
it['environment_name'] == environmentName &&
it['space'] == 'default'
}
serviceVersions.any {
it['name'] == 'test2' &&
it['version'] == "1.3" &&
it['environment_name'] == environmentName &&
it['space'] == 'default'
}
}

def "should update environment and replace namespace"() {
Expand Down Expand Up @@ -86,6 +92,47 @@ class EnvironmentControllerFT extends PostgresDatabaseSpecification {
}
}

@Sql("EnvironmentControllerFT.sql")
def "should update service version and replace namespace for one service"() {
given:
def environmentName = 'TEST1'
def space = 'testSpace'

when:
RestAssured.given()
.port(serverPort)
.contentType("application/json")
.header('X-JUDGE-D-AGENT-SPACE', space)
.body("""[
{
"name": "test-service-1",
"version": "3.0"
}
]""")
.when()
.put("/environments/${environmentName}")
.then()
.statusCode(200)

then:
dbHelper.fetchEnvironments()[0]['name'] == environmentName
def serviceVersions = dbHelper.fetchServiceVersions().findAll {
it['environment_name'] == environmentName
}
serviceVersions.any {
it['name'] == 'test-service-1' &&
it['version'] == "3.0" &&
it['environment_name'] == environmentName &&
it['space'] == space
}
serviceVersions.any {
it['name'] == 'test-service-2' &&
it['version'] == "2.0" &&
it['environment_name'] == environmentName &&
it['space'] == 'default'
}
}

@Sql("EnvironmentControllerFT.sql")
def "should get all environments"() {
when:
Expand Down

0 comments on commit 94745ac

Please sign in to comment.