Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): Clouddriver integration tests (#4827)
* feat(test): First commit of integration tests module * feat(test): Added k3s for integration tests * feat(test): Make spotless happy * feat(test): First deploy manifests int tests * feat(test): Run integration tests on PR builds * feat(test): Moved integration tests to cloud provider module * feat(test): Explicit code over test helpers * feat(test): Cleanup compilation warnings * feat(test): More deploy manifest tests
- Loading branch information
1 parent
3d467ed
commit 0c85aac
Showing
15 changed files
with
1,541 additions
and
1 deletion.
There are no files selected for viewing
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
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
66 changes: 66 additions & 0 deletions
66
...rnetes/src/integration/java/com/netflix/spinnaker/clouddriver/kubernetes/it/BaseTest.java
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,66 @@ | ||
/* | ||
* Copyright 2020 Armory | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.clouddriver.kubernetes.it; | ||
|
||
import static io.restassured.RestAssured.get; | ||
import static org.hamcrest.Matchers.hasItems; | ||
|
||
import com.netflix.spinnaker.clouddriver.Main; | ||
import com.netflix.spinnaker.clouddriver.kubernetes.it.containers.KubernetesCluster; | ||
import io.restassured.RestAssured; | ||
import io.restassured.response.Response; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.web.server.LocalServerPort; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
@SpringBootTest( | ||
classes = {Main.class}, | ||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@TestPropertySource(properties = {"spring.config.location = classpath:clouddriver.yml"}) | ||
public abstract class BaseTest { | ||
|
||
public static final String APP1_NAME = "testApp1"; | ||
public static final String ACCOUNT1_NAME = "account1"; | ||
|
||
@LocalServerPort int port; | ||
|
||
public static final KubernetesCluster kubeCluster; | ||
|
||
static { | ||
kubeCluster = KubernetesCluster.getInstance(ACCOUNT1_NAME); | ||
kubeCluster.start(); | ||
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); | ||
} | ||
|
||
public String baseUrl() { | ||
return "http://localhost:" + port; | ||
} | ||
|
||
@BeforeEach | ||
void givenAccountsReady() { | ||
Response response = get(baseUrl() + "/credentials"); | ||
response | ||
.then() | ||
.log() | ||
.ifValidationFails() | ||
.assertThat() | ||
.statusCode(200) | ||
.and() | ||
.body("name", hasItems(ACCOUNT1_NAME)); | ||
} | ||
} |
Oops, something went wrong.