@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-example", "spring.cloud.kubernetes.reload.enabled=false",
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BoostrapConfigMapsTests extends ConfigMapsTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, properties = {
|
||||
"spring.application.name=configmap-path-example", "spring.cloud.kubernetes.config.enableApi=false",
|
||||
"spring.cloud.kubernetes.config.paths=" + BootstrapConfigMapsFromFilePathsTests.FIRST_FILE_NAME_FULL_PATH + ","
|
||||
+ BootstrapConfigMapsFromFilePathsTests.SECOND_FILE_NAME_FULL_PATH + ","
|
||||
+ BootstrapConfigMapsFromFilePathsTests.FIRST_FILE_NAME_DUPLICATED_FULL_PATH,
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapConfigMapsFromFilePathsTests extends ConfigMapsFromFilePathsTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() throws IOException {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
/**
|
||||
* @author Ali Shahbour
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-active-profile-name-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
@ActiveProfiles("development")
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapConfigMapsWithActiveProfilesNameTests extends ConfigMapsWithActiveProfilesNameTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-no-active-profiles-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapConfigMapsWithProfilesNoActiveProfileTests extends ConfigMapsWithProfilesNoActiveProfileTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
@ActiveProfiles("development")
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapConfigMapsWithProfilesTests extends ConfigMapsWithProfilesTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-without-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
@ActiveProfiles("development")
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapConfigMapsWithoutProfilesTests extends ConfigMapsWithoutProfilesTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2021 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = TestApplication.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.application.name=testapp",
|
||||
"spring.cloud.kubernetes.client.namespace=testns", "spring.cloud.kubernetes.client.trustCerts=true",
|
||||
"spring.cloud.kubernetes.config.namespace=testns", "spring.cloud.kubernetes.secrets.enableApi=true",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
public class BootstrapCoreTestClientViaSystemProperties extends CoreTestClientViaSystemProperties {
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class, properties = {
|
||||
"spring.application.name=configmap-path-example", "spring.cloud.kubernetes.config.enableApi=false",
|
||||
"spring.cloud.kubernetes.config.paths=" + ConfigDataConfigMapsFromFilePathsTests.FIRST_FILE_NAME_FULL_PATH + ","
|
||||
+ ConfigDataConfigMapsFromFilePathsTests.SECOND_FILE_NAME_FULL_PATH + ","
|
||||
+ ConfigDataConfigMapsFromFilePathsTests.FIRST_FILE_NAME_DUPLICATED_FULL_PATH,
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsFromFilePathsTests extends ConfigMapsFromFilePathsTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() throws IOException {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
/**
|
||||
* @author Ali Shahbour
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-active-profile-name-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
@ActiveProfiles("development")
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsWithActiveProfilesNameTests extends ConfigMapsWithActiveProfilesNameTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* Tests reading property from YAML document specified by profile expression.
|
||||
*/
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
@ActiveProfiles({ "production", "us-east" })
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsWithProfileExpressionTests extends ConfigMapsWithProfileExpressionTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
@ActiveProfiles("development")
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsWithProfilesTests extends ConfigMapsWithProfilesTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-without-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
@ActiveProfiles("development")
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsWithoutProfilesTests extends ConfigMapsWithoutProfilesTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2021 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = TestApplication.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.application.name=testapp",
|
||||
"spring.cloud.kubernetes.client.namespace=testns", "spring.cloud.kubernetes.client.trustCerts=true",
|
||||
"spring.cloud.kubernetes.config.namespace=testns", "spring.cloud.kubernetes.secrets.enableApi=true",
|
||||
"spring.config.import=kubernetes:" })
|
||||
public class ConfigDataCoreTestClientViaSystemProperties extends CoreTestClientViaSystemProperties {
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example2.ExampleApp;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ExampleApp.class,
|
||||
properties = { "spring.application.name=multiplecms", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:,classpath:./multiplecms.yml" })
|
||||
@AutoConfigureWebTestClient
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataMultipleConfigMapsTests extends MultipleConfigMapsTests {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,18 +20,20 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.fabric8.kubernetes.client.utils.IOHelpers;
|
||||
|
||||
final class ConfigMapTestUtil {
|
||||
public final class ConfigMapTestUtil {
|
||||
|
||||
private ConfigMapTestUtil() {
|
||||
}
|
||||
|
||||
static String readResourceFile(String file) {
|
||||
public static String readResourceFile(String file) {
|
||||
String resource;
|
||||
try {
|
||||
resource = IOHelpers.readFully(ConfigMapTestUtil.class.getClassLoader().getResourceAsStream(file));
|
||||
resource = IOHelpers
|
||||
.readFully(Objects.requireNonNull(ConfigMapTestUtil.class.getClassLoader().getResourceAsStream(file)));
|
||||
}
|
||||
catch (IOException e) {
|
||||
resource = "";
|
||||
@@ -39,7 +41,7 @@ final class ConfigMapTestUtil {
|
||||
return resource;
|
||||
}
|
||||
|
||||
static void createFileWithContent(String file, String content) throws IOException {
|
||||
public static void createFileWithContent(String file, String content) throws IOException {
|
||||
Files.write(Paths.get(file), content.getBytes(), StandardOpenOption.CREATE);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class ConfigMapsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigMapList() {
|
||||
void testConfigMapList() {
|
||||
mockClient.configMaps()
|
||||
.inNamespace("ns1")
|
||||
.resource(new ConfigMapBuilder().withNewMetadata().withName("empty").endMetadata().build())
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.retry.annotation.EnableRetry;
|
||||
|
||||
/**
|
||||
* @author Ryan Baxter
|
||||
*/
|
||||
@Order(0)
|
||||
@Configuration
|
||||
@ConditionalOnProperty("spring.cloud.kubernetes.test.enable-retry")
|
||||
@EnableRetry
|
||||
public class EnableRetryBootstrapConfiguration {
|
||||
|
||||
}
|
||||
@@ -25,11 +25,10 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES", "management.endpoint.health.show-details=always" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class HealthIndicatorTest {
|
||||
|
||||
@@ -35,14 +35,14 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith({ SpringExtension.class, OutputCaptureExtension.class })
|
||||
@ClassPathExclusions({ "spring-boot-actuator-autoconfigure-*.jar", "spring-boot-starter-actuator-*.jar" })
|
||||
public class MissingActuatorTest {
|
||||
class MissingActuatorTest {
|
||||
|
||||
private static ConfigurableApplicationContext getApplicationContext(String... properties) {
|
||||
return new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).properties(properties).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unknownClassProtected(CapturedOutput capturedOutput) {
|
||||
void unknownClassProtected(CapturedOutput capturedOutput) {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext("debug=true",
|
||||
"spring.cloud.kubernetes.client.namespace=default")) {
|
||||
String output = capturedOutput.toString();
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Ryan Baxter
|
||||
*/
|
||||
@EnableKubernetesMockClient
|
||||
public class SecretsEnableRetryWithoutFailFastTest {
|
||||
class SecretsEnableRetryWithoutFailFastTests {
|
||||
|
||||
private static final String API = "/api/v1/namespaces/default/configmaps/application";
|
||||
|
||||
@@ -52,7 +52,7 @@ public class SecretsEnableRetryWithoutFailFastTest {
|
||||
|
||||
private ConfigurableApplicationContext context;
|
||||
|
||||
protected void setup(String... env) {
|
||||
void setup(String... env) {
|
||||
List<String> envList = (env != null) ? new ArrayList<>(Arrays.asList(env)) : new ArrayList<>();
|
||||
envList.add("spring.cloud.kubernetes.client.namespace=default");
|
||||
String[] envArray = envList.toArray(new String[0]);
|
||||
@@ -69,7 +69,7 @@ public class SecretsEnableRetryWithoutFailFastTest {
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() {
|
||||
void afterEach() {
|
||||
if (this.context != null) {
|
||||
this.context.close();
|
||||
this.context = null;
|
||||
@@ -77,7 +77,7 @@ public class SecretsEnableRetryWithoutFailFastTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotContainRetryableSecretsPropertySourceLocator() throws Exception {
|
||||
void doesNotContainRetryableSecretsPropertySourceLocator() throws Exception {
|
||||
mockServer.expect().withPath(API).andReturn(500, "Internal Server Error").once();
|
||||
setup("debug=true", "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.test.enable-retry=true",
|
||||
"spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true");
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,18 +23,18 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "management.health.kubernetes.enabled=false", "management.endpoint.health.show-details=always",
|
||||
"management.endpoint.health.show-components=always", "management.endpoints.web.exposure.include=health",
|
||||
"spring.cloud.kubernetes.client.namespace=default" })
|
||||
class DisabledHealthTest {
|
||||
class DisabledHealthTests {
|
||||
|
||||
@Autowired
|
||||
private ReactiveHealthContributorRegistry registry;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,18 +23,18 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.server.LocalManagementPort;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "management.health.kubernetes.enabled=true", "management.endpoint.health.show-details=always",
|
||||
"management.endpoint.health.show-components=always", "management.endpoints.web.exposure.include=health",
|
||||
"spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" })
|
||||
class EnabledHealthTest {
|
||||
class EnabledHealthTests {
|
||||
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Fabric8ConfigMapPropertySourceLocator;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Fabric8SecretsPropertySourceLocator;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -30,10 +30,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.client.namespace=abc",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
class Fabric8BootstrapConfigurationInsideK8s {
|
||||
class Fabric8BootstrapConfigurationInsideK8sTests {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext context;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,15 +20,15 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Fabric8ConfigMapPropertySourceLocator;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Fabric8SecretsPropertySourceLocator;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class)
|
||||
class Fabric8BootstrapConfigurationNotInsideK8s {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class)
|
||||
class Fabric8BootstrapConfigurationNotInsideK8sTests {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext context;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_disabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
class BootstrapKubernetesDisabled extends KubernetesDisabled {
|
||||
class BootstrapKubernetesDisabledTests extends KubernetesDisabled {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_disabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES" })
|
||||
class ConfigDataKubernetesDisabled extends KubernetesDisabled {
|
||||
class ConfigDataKubernetesDisabledTests extends KubernetesDisabled {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_disabled;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_disabled_secrets_enabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.secrets.enabled=false",
|
||||
"spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
class BootstrapKubernetesEnabledSecretsDisabled extends KubernetesEnabledSecretsDisabled {
|
||||
class BootstrapKubernetesEnabledSecretsDisabledTests extends KubernetesEnabledSecretsDisabled {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_disabled_secrets_enabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.secrets.enabled=false",
|
||||
"spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
class ConfigDataKubernetesEnabledSecretsDisabled extends KubernetesEnabledSecretsDisabled {
|
||||
class ConfigDataKubernetesEnabledSecretsDisabledTests extends KubernetesEnabledSecretsDisabled {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_disabled_secrets_enabled;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,14 +17,14 @@
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
class BootstrapKubernetesEnabled extends KubernetesEnabled {
|
||||
class BootstrapKubernetesEnabledTests extends KubernetesEnabled {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,14 +17,14 @@
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
class ConfigDataKubernetesEnabled extends KubernetesEnabled {
|
||||
class ConfigDataKubernetesEnabledTests extends KubernetesEnabled {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2021 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled_config_disabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.config.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
class BoostrapKubernetesEnabledConfigDisabled extends KubernetesEnabledConfigDisabled {
|
||||
class BoostrapKubernetesEnabledConfigDisabledTests extends KubernetesEnabledConfigDisabled {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2021 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled_config_disabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.config.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
class ConfigDataKubernetesEnabledConfigDisabled extends KubernetesEnabledConfigDisabled {
|
||||
class ConfigDataKubernetesEnabledConfigDisabledTests extends KubernetesEnabledConfigDisabled {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled_config_disabled;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled_explicitly;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.secrets.enabled=true",
|
||||
"spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
class BootstrapKubernetesEnabledOnPurpose extends KubernetesEnabledOnPurpose {
|
||||
class BootstrapKubernetesEnabledExplicitlyTests extends KubernetesEnabledExplicitly {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled_explicitly;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.secrets.enabled=true",
|
||||
"spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
class ConfigDataKubernetesEnabledOnPurpose extends KubernetesEnabledOnPurpose {
|
||||
class ConfigDataKubernetesEnabledExplicitlyTests extends KubernetesEnabledExplicitly {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_enabled_explicitly;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
abstract class KubernetesEnabledOnPurpose {
|
||||
abstract class KubernetesEnabledExplicitly {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext context;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_secrets_enabled_config_disabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.secrets.enabled=false", "spring.cloud.kubernetes.config.enabled=false",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
class BootstrapKubernetesEnabledSecretsAndConfigDisabled extends KubernetesEnabledSecretsAndConfigDisabled {
|
||||
class BootstrapKubernetesEnabledSecretsAndConfigDisabledTests extends KubernetesEnabledSecretsAndConfigDisabled {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_secrets_enabled_config_disabled;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.cloud.kubernetes.secrets.enabled=false", "spring.cloud.kubernetes.config.enabled=false",
|
||||
"spring.config.import=kubernetes:", "spring.main.cloud-platform=KUBERNETES" })
|
||||
class ConfigDataKubernetesEnabledSecretsAndConfigDisabled extends KubernetesEnabledSecretsAndConfigDisabled {
|
||||
class ConfigDataKubernetesEnabledSecretsAndConfigDisabledTests extends KubernetesEnabledSecretsAndConfigDisabled {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.bootstrap.kubernetes_secrets_enabled_config_disabled;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_map_source;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class BoostrapConfigMapsTests extends ConfigMapSource {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,33 +14,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_source;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-example", "spring.cloud.kubernetes.reload.enabled=false",
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" })
|
||||
@AutoConfigureWebTestClient
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsTests extends ConfigMapsTests {
|
||||
class ConfigDataConfigMapsTests extends ConfigMapSource {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_source;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -25,6 +25,8 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -32,7 +34,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
abstract class ConfigMapsTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=configmap-example", "spring.cloud.kubernetes.reload.enabled=false",
|
||||
"spring.main.cloud-platform=KUBERNETES" })
|
||||
abstract class ConfigMapSource {
|
||||
|
||||
private static final String APPLICATION_NAME = "configmap-example";
|
||||
|
||||
@@ -45,7 +50,7 @@ abstract class ConfigMapsTests {
|
||||
private WebTestClient webClient;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
ConfigMapsTests.mockClient = mockClient;
|
||||
ConfigMapSource.mockClient = mockClient;
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_map_with_active_profile_no_profile;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class BootstrapConfigMapsWithProfilesNoActiveProfileTests extends ConfigMapsWithProfilesNoActiveProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,29 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_with_active_profile_no_profile;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-no-active-profiles-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
@AutoConfigureWebTestClient
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsWithProfilesNoActiveProfileTests extends ConfigMapsWithProfilesNoActiveProfileTests {
|
||||
public class ConfigDataConfigMapsWithProfilesNoActiveProfileTests extends ConfigMapsWithProfilesNoActiveProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_with_active_profile_no_profile;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -24,6 +24,8 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestUtil.readResourceFile;
|
||||
@@ -31,14 +33,17 @@ import static org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestU
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
abstract class ConfigMapsWithProfilesNoActiveProfileTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-no-active-profiles-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" })
|
||||
abstract class ConfigMapsWithProfilesNoActiveProfile {
|
||||
|
||||
private static final String APPLICATION_NAME = "configmap-with-profile-no-active-profiles-example";
|
||||
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
@@ -61,7 +66,7 @@ abstract class ConfigMapsWithProfilesNoActiveProfileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGreetingEndpoint() {
|
||||
void testGreetingEndpoint() {
|
||||
this.webClient.get()
|
||||
.uri("/api/greeting")
|
||||
.exchange()
|
||||
@@ -73,7 +78,7 @@ abstract class ConfigMapsWithProfilesNoActiveProfileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFarewellEndpoint() {
|
||||
void testFarewellEndpoint() {
|
||||
this.webClient.get()
|
||||
.uri("/api/farewell")
|
||||
.exchange()
|
||||
@@ -14,29 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_with_profile_expression;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* Tests reading property from YAML document specified by profile expression.
|
||||
*/
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
@ActiveProfiles({ "production", "us-east" })
|
||||
@AutoConfigureWebTestClient
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class BootstrapConfigMapsWithProfileExpressionTests extends ConfigMapsWithProfileExpressionTests {
|
||||
class BootstrapConfigMapsWithProfileExpressionTests extends ConfigMapsWithProfileExpression {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_map_with_profile_expression;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* Tests reading property from YAML document specified by profile expression.
|
||||
*/
|
||||
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class ConfigDataConfigMapsWithProfileExpressionTests extends ConfigMapsWithProfileExpression {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_with_profile_expression;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -24,20 +24,27 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestUtil;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* Tests reading property from YAML document specified by profile expression.
|
||||
*/
|
||||
|
||||
abstract class ConfigMapsWithProfileExpressionTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" })
|
||||
@ActiveProfiles({ "production", "us-east" })
|
||||
abstract class ConfigMapsWithProfileExpression {
|
||||
|
||||
private static final String APPLICATION_NAME = "configmap-with-profile-example";
|
||||
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
@@ -60,7 +67,7 @@ abstract class ConfigMapsWithProfileExpressionTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGreetingEndpoint() {
|
||||
void testGreetingEndpoint() {
|
||||
this.webClient.get()
|
||||
.uri("/api/greeting")
|
||||
.exchange()
|
||||
@@ -14,28 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_with_profiles;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example2.ExampleApp;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ExampleApp.class,
|
||||
properties = { "spring.cloud.bootstrap.name=multiplecms", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
@AutoConfigureWebTestClient
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BoostrapMultipleConfigMapsTests extends MultipleConfigMapsTests {
|
||||
public class BootstrapConfigMapsWithProfilesTests extends ConfigMapsWithProfiles {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_map_with_profiles;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class ConfigDataConfigMapsWithProfilesTests extends ConfigMapsWithProfiles {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_map_with_profiles;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -24,12 +24,20 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestUtil;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
abstract class ConfigMapsWithProfilesTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=configmap-with-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" })
|
||||
@ActiveProfiles("development")
|
||||
abstract class ConfigMapsWithProfiles {
|
||||
|
||||
private static final String APPLICATION_NAME = "configmap-with-profile-example";
|
||||
|
||||
@@ -39,7 +47,7 @@ abstract class ConfigMapsWithProfilesTests {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
@@ -62,7 +70,7 @@ abstract class ConfigMapsWithProfilesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGreetingEndpoint() {
|
||||
void testGreetingEndpoint() {
|
||||
this.webClient.get()
|
||||
.uri("/api/greeting")
|
||||
.exchange()
|
||||
@@ -74,7 +82,7 @@ abstract class ConfigMapsWithProfilesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFarewellEndpoint() {
|
||||
void testFarewellEndpoint() {
|
||||
this.webClient.get()
|
||||
.uri("/api/farewell")
|
||||
.exchange()
|
||||
@@ -14,27 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_maps_mixed;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=" + BootstrapConfigMapsMixedTests.APPLICATION_NAME,
|
||||
"spring.cloud.kubernetes.config.enableApi=true",
|
||||
"spring.cloud.kubernetes.config.paths=" + BootstrapConfigMapsMixedTests.FILE_NAME_FULL_PATH,
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapConfigMapsMixedTests extends ConfigMapsMixedTests {
|
||||
public class BootstrapConfigMapsMixedTests extends ConfigMapsMixed {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -14,27 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_maps_mixed;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
properties = { "spring.application.name=" + ConfigDataConfigMapsMixedTests.APPLICATION_NAME,
|
||||
"spring.cloud.kubernetes.config.enableApi=true",
|
||||
"spring.cloud.kubernetes.config.paths=" + ConfigDataConfigMapsMixedTests.FILE_NAME_FULL_PATH,
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" })
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsMixedTests extends ConfigMapsMixedTests {
|
||||
public class ConfigDataConfigMapsMixedTests extends ConfigMapsMixed {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_maps_mixed;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@@ -29,11 +29,19 @@ import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestUtil;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.assertj.core.util.Lists.newArrayList;
|
||||
|
||||
abstract class ConfigMapsMixedTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=" + BootstrapConfigMapsMixedTests.APPLICATION_NAME,
|
||||
"spring.cloud.kubernetes.config.enableApi=true",
|
||||
"spring.cloud.kubernetes.config.paths=" + BootstrapConfigMapsMixedTests.FILE_NAME_FULL_PATH,
|
||||
"spring.main.cloud-platform=KUBERNETES" })
|
||||
abstract class ConfigMapsMixed {
|
||||
|
||||
protected static final String FILES_ROOT_PATH = "/tmp/scktests";
|
||||
|
||||
@@ -46,7 +54,7 @@ abstract class ConfigMapsMixedTests {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) throws IOException {
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) throws IOException {
|
||||
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
@@ -73,7 +81,7 @@ abstract class ConfigMapsMixedTests {
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void teardownAfterClass() {
|
||||
static void teardownAfterClass() {
|
||||
newArrayList(FILE_NAME_FULL_PATH, FILES_ROOT_PATH).forEach(fn -> {
|
||||
try {
|
||||
Files.delete(Paths.get(fn));
|
||||
@@ -84,7 +92,7 @@ abstract class ConfigMapsMixedTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void greetingInputShouldReturnPropertyFromFile() {
|
||||
void greetingInputShouldReturnPropertyFromFile() {
|
||||
this.webClient.get()
|
||||
.uri("/api/greeting")
|
||||
.exchange()
|
||||
@@ -96,7 +104,7 @@ abstract class ConfigMapsMixedTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void farewellInputShouldReturnPropertyFromFile() {
|
||||
void farewellInputShouldReturnPropertyFromFile() {
|
||||
this.webClient.get()
|
||||
.uri("/api/farewell")
|
||||
.exchange()
|
||||
@@ -108,7 +116,7 @@ abstract class ConfigMapsMixedTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void morningInputShouldReturnPropertyFromApi() {
|
||||
void morningInputShouldReturnPropertyFromApi() {
|
||||
this.webClient.get()
|
||||
.uri("/api/morning")
|
||||
.exchange()
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_maps_with_active_profiles;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Ali Shahbour
|
||||
*/
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapConfigMapsWithActiveProfilesNameTests extends ConfigMapsWithActiveProfilesName {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_maps_with_active_profiles;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Ali Shahbour
|
||||
*/
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class ConfigDataConfigMapsWithActiveProfilesNameTests extends ConfigMapsWithActiveProfilesName {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_maps_with_active_profiles;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -24,14 +24,22 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
import static org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestUtil.readResourceFile;
|
||||
|
||||
/**
|
||||
* @author Ali Shahbour
|
||||
*/
|
||||
abstract class ConfigMapsWithActiveProfilesNameTests {
|
||||
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=configmap-with-active-profile-name-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" })
|
||||
@ActiveProfiles("development")
|
||||
abstract class ConfigMapsWithActiveProfilesName {
|
||||
|
||||
private static final String APPLICATION_NAME = "configmap-with-active-profile-name-example";
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_maps_without_profiles;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class BootstrapConfigMapsWithoutProfilesTests extends ConfigMapsWithoutProfiles {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.config_maps_without_profiles;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataConfigMapsWithoutProfilesTests extends ConfigMapsWithoutProfiles {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.config_maps_without_profiles;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -24,16 +24,24 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestUtil;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
abstract class ConfigMapsWithoutProfilesTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=configmap-without-profile-example",
|
||||
"spring.cloud.kubernetes.reload.enabled=false", "spring.main.cloud-platform=KUBERNETES" })
|
||||
@ActiveProfiles("development")
|
||||
abstract class ConfigMapsWithoutProfiles {
|
||||
|
||||
private static final String APPLICATION_NAME = "configmap-without-profile-example";
|
||||
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
@@ -56,7 +64,7 @@ abstract class ConfigMapsWithoutProfilesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGreetingEndpoint() {
|
||||
void testGreetingEndpoint() {
|
||||
this.webClient.get()
|
||||
.uri("/api/greeting")
|
||||
.exchange()
|
||||
@@ -68,7 +76,7 @@ abstract class ConfigMapsWithoutProfilesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFarewellEndpoint() {
|
||||
void testFarewellEndpoint() {
|
||||
this.webClient.get()
|
||||
.uri("/api/farewell")
|
||||
.exchange()
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.configmaps_from_file_paths;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class BootstrapConfigMapsFromFilePathsTests extends ConfigMapsFromFilePaths {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() throws IOException {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.configmaps_from_file_paths;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class ConfigDataConfigMapsFromFilePathsTests extends ConfigMapsFromFilePaths {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
static void setUpBeforeClass() throws IOException {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,35 +14,32 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.configmaps_from_file_paths;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
import io.fabric8.kubernetes.client.Config;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.ConfigMapTestUtil;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.assertj.core.util.Lists.newArrayList;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class,
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class,
|
||||
properties = { "spring.application.name=configmap-path-example",
|
||||
"spring.cloud.kubernetes.config.enableApi=false",
|
||||
"spring.cloud.kubernetes.config.paths=" + ConfigMapsFromFilePathsTests.FIRST_FILE_NAME_FULL_PATH + ","
|
||||
+ ConfigMapsFromFilePathsTests.SECOND_FILE_NAME_FULL_PATH + ","
|
||||
+ ConfigMapsFromFilePathsTests.FIRST_FILE_NAME_DUPLICATED_FULL_PATH,
|
||||
"spring.cloud.kubernetes.config.paths=" + ConfigMapsFromFilePaths.FIRST_FILE_NAME_FULL_PATH + ","
|
||||
+ ConfigMapsFromFilePaths.SECOND_FILE_NAME_FULL_PATH + ","
|
||||
+ ConfigMapsFromFilePaths.FIRST_FILE_NAME_DUPLICATED_FULL_PATH,
|
||||
"spring.main.cloud-platform=KUBERNETES" })
|
||||
abstract class ConfigMapsFromFilePathsTests {
|
||||
abstract class ConfigMapsFromFilePaths {
|
||||
|
||||
protected static final String FILES_ROOT_PATH = "/tmp/scktests";
|
||||
|
||||
@@ -66,7 +63,7 @@ abstract class ConfigMapsFromFilePathsTests {
|
||||
@Autowired
|
||||
private WebTestClient webClient;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) throws IOException {
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) throws IOException {
|
||||
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
@@ -84,8 +81,8 @@ abstract class ConfigMapsFromFilePathsTests {
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void teardownAfterClass() {
|
||||
newArrayList(FIRST_FILE_NAME_FULL_PATH, SECOND_FILE_NAME_FULL_PATH, SECOND_FILE_NAME_FULL_PATH, FILES_ROOT_PATH)
|
||||
static void teardownAfterClass() {
|
||||
List.of(FIRST_FILE_NAME_FULL_PATH, SECOND_FILE_NAME_FULL_PATH, SECOND_FILE_NAME_FULL_PATH, FILES_ROOT_PATH)
|
||||
.forEach(fn -> {
|
||||
try {
|
||||
Files.delete(Paths.get(fn));
|
||||
@@ -96,7 +93,7 @@ abstract class ConfigMapsFromFilePathsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void greetingInputShouldReturnPropertyFromFirstFile() {
|
||||
void greetingInputShouldReturnPropertyFromFirstFile() {
|
||||
this.webClient.get()
|
||||
.uri("/api/greeting")
|
||||
.exchange()
|
||||
@@ -108,7 +105,7 @@ abstract class ConfigMapsFromFilePathsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void farewellInputShouldReturnPropertyFromSecondFile() {
|
||||
void farewellInputShouldReturnPropertyFromSecondFile() {
|
||||
this.webClient.get()
|
||||
.uri("/api/farewell")
|
||||
.exchange()
|
||||
@@ -120,7 +117,7 @@ abstract class ConfigMapsFromFilePathsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void morningInputShouldReturnDefaultValue() {
|
||||
void morningInputShouldReturnDefaultValue() {
|
||||
this.webClient.get()
|
||||
.uri("/api/morning")
|
||||
.exchange()
|
||||
@@ -132,7 +129,7 @@ abstract class ConfigMapsFromFilePathsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bonjourInputShouldReturnPropertyFromDuplicatedFile() {
|
||||
void bonjourInputShouldReturnPropertyFromDuplicatedFile() {
|
||||
this.webClient.get()
|
||||
.uri("/api/bonjour")
|
||||
.exchange()
|
||||
@@ -14,29 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.core;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = TestApplication.class,
|
||||
properties = { "spring.application.name=testapp", "spring.cloud.kubernetes.client.namespace=testns",
|
||||
"spring.cloud.kubernetes.client.trustCerts=true", "spring.cloud.kubernetes.config.namespace=testns",
|
||||
"spring.cloud.kubernetes.secrets.enableApi=true", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" })
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class ConfigDataCoreTest extends CoreTest {
|
||||
class BootstrapCoreTests extends Core {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
@@ -14,29 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.core;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = TestApplication.class,
|
||||
properties = { "spring.application.name=testapp", "spring.cloud.kubernetes.client.namespace=testns",
|
||||
"spring.cloud.kubernetes.client.trustCerts=true", "spring.cloud.kubernetes.config.namespace=testns",
|
||||
"spring.cloud.kubernetes.secrets.enableApi=true", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" })
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
public class BootstrapCoreTest extends CoreTest {
|
||||
class ConfigDataCoreTests extends Core {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
static void setUpBeforeClass() {
|
||||
setUpBeforeClass(mockClient);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -26,11 +26,17 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
abstract class CoreTest {
|
||||
@SpringBootTest(classes = TestApplication.class,
|
||||
properties = { "spring.application.name=testapp", "spring.cloud.kubernetes.client.namespace=testns",
|
||||
"spring.cloud.kubernetes.client.trustCerts=true", "spring.cloud.kubernetes.config.namespace=testns",
|
||||
"spring.cloud.kubernetes.secrets.enableApi=true", "spring.main.cloud-platform=KUBERNETES" })
|
||||
abstract class Core {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -40,8 +46,8 @@ abstract class CoreTest {
|
||||
@Autowired
|
||||
private Config config;
|
||||
|
||||
public static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
CoreTest.mockClient = mockClient;
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
Core.mockClient = mockClient;
|
||||
Map<String, String> data1 = new HashMap<>();
|
||||
data1.put("spring.kubernetes.test.value", "value1");
|
||||
mockClient.configMaps()
|
||||
@@ -67,7 +73,7 @@ abstract class CoreTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kubernetesClientConfigBeanShouldBeConfigurableViaSystemProperties() {
|
||||
void kubernetesClientConfigBeanShouldBeConfigurableViaSystemProperties() {
|
||||
assertThat(config).isNotNull();
|
||||
assertThat(config.getMasterUrl()).isEqualTo(mockClient.getConfiguration().getMasterUrl());
|
||||
assertThat(config.getNamespace()).isEqualTo("testns");
|
||||
@@ -75,12 +81,12 @@ abstract class CoreTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesShouldBeReadFromConfigMap() {
|
||||
void propertiesShouldBeReadFromConfigMap() {
|
||||
assertThat(environment.getProperty("spring.kubernetes.test.value")).isEqualTo("value1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesShouldBeReadFromSecret() {
|
||||
void propertiesShouldBeReadFromSecret() {
|
||||
assertThat(environment.getProperty("amq.user")).isEqualTo("admin");
|
||||
assertThat(environment.getProperty("amq.pwd")).isEqualTo("1f2d1e2e67df");
|
||||
}
|
||||
@@ -14,14 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.core_system_properties;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
@TestPropertySource(properties = "spring.cloud.bootstrap.eanbled=true")
|
||||
class BootstrapCoreTestClientViaSystemPropertiesTests extends CoreTestClientViaSystemProperties {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2013-2021 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.cloud.kubernetes.fabric8.config.core_system_properties;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
public class ConfigDataCoreTestClientViaSystemPropertiesTests extends CoreTestClientViaSystemProperties {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.core_system_properties;
|
||||
|
||||
import io.fabric8.kubernetes.client.Config;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
@@ -22,21 +22,27 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(classes = TestApplication.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.application.name=testapp",
|
||||
"spring.cloud.kubernetes.client.namespace=testns", "spring.cloud.kubernetes.client.trustCerts=true",
|
||||
"spring.cloud.kubernetes.config.namespace=testns", "spring.cloud.kubernetes.secrets.enableApi=true" })
|
||||
abstract class CoreTestClientViaSystemProperties {
|
||||
|
||||
@Autowired
|
||||
private KubernetesClient client;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUpBeforeClass() {
|
||||
static void setUpBeforeClass() {
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, "masterURL");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kubernetesClientBeanShouldBeConfigurableViaSystemProperties() {
|
||||
void kubernetesClientBeanShouldBeConfigurableViaSystemProperties() {
|
||||
assertThat(client).isNotNull();
|
||||
assertThat(client.getConfiguration().getMasterUrl()).isEqualTo("http://masterURL/");
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
*/
|
||||
@EnableConfigurationProperties(GreetingProperties.class)
|
||||
@SpringBootApplication
|
||||
public class App {
|
||||
class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(App.class, args);
|
||||
|
||||
@@ -25,32 +25,32 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
@RestController
|
||||
public class GreetingController {
|
||||
class GreetingController {
|
||||
|
||||
private final GreetingProperties properties;
|
||||
|
||||
@Autowired
|
||||
public GreetingController(GreetingProperties properties) {
|
||||
GreetingController(GreetingProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@RequestMapping("/api/greeting")
|
||||
public ResponseMessage greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
ResponseMessage greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
return new ResponseMessage(String.format(this.properties.getGreeting(), name));
|
||||
}
|
||||
|
||||
@RequestMapping("/api/farewell")
|
||||
public ResponseMessage farewell(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
ResponseMessage farewell(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
return new ResponseMessage(String.format(this.properties.getFarewell(), name));
|
||||
}
|
||||
|
||||
@RequestMapping("/api/morning")
|
||||
public ResponseMessage morning(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
ResponseMessage morning(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
return new ResponseMessage(String.format(this.properties.getMorning(), name));
|
||||
}
|
||||
|
||||
@RequestMapping("/api/bonjour")
|
||||
public ResponseMessage bonjour(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
ResponseMessage bonjour(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
return new ResponseMessage(String.format(this.properties.getBonjour(), name));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.kubernetes.fabric8.config.example;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "bean")
|
||||
public class GreetingProperties {
|
||||
class GreetingProperties {
|
||||
|
||||
private String greeting = "Hello, %s!";
|
||||
|
||||
@@ -29,35 +29,35 @@ public class GreetingProperties {
|
||||
|
||||
private String bonjour = "Bonjour, %s!";
|
||||
|
||||
public String getGreeting() {
|
||||
String getGreeting() {
|
||||
return this.greeting;
|
||||
}
|
||||
|
||||
public void setGreeting(String greeting) {
|
||||
void setGreeting(String greeting) {
|
||||
this.greeting = greeting;
|
||||
}
|
||||
|
||||
public String getFarewell() {
|
||||
String getFarewell() {
|
||||
return this.farewell;
|
||||
}
|
||||
|
||||
public void setFarewell(String farewell) {
|
||||
void setFarewell(String farewell) {
|
||||
this.farewell = farewell;
|
||||
}
|
||||
|
||||
public String getMorning() {
|
||||
String getMorning() {
|
||||
return this.morning;
|
||||
}
|
||||
|
||||
public void setMorning(String morning) {
|
||||
void setMorning(String morning) {
|
||||
this.morning = morning;
|
||||
}
|
||||
|
||||
public String getBonjour() {
|
||||
String getBonjour() {
|
||||
return this.bonjour;
|
||||
}
|
||||
|
||||
public void setBonjour(String bonjour) {
|
||||
void setBonjour(String bonjour) {
|
||||
this.bonjour = bonjour;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,20 +19,5 @@ package org.springframework.cloud.kubernetes.fabric8.config.example;
|
||||
/**
|
||||
* @author Charles Moulliard
|
||||
*/
|
||||
public class ResponseMessage {
|
||||
|
||||
private final String content;
|
||||
|
||||
public ResponseMessage() {
|
||||
this.content = null;
|
||||
}
|
||||
|
||||
public ResponseMessage(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
record ResponseMessage(String content) {
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.cloud.kubernetes.fabric8.config.example2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.example.App;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -28,51 +27,41 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class ExampleApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(App.class, args);
|
||||
SpringApplication.run(ExampleApp.class, args);
|
||||
}
|
||||
|
||||
@RestController
|
||||
public static class Controller {
|
||||
static class Controller {
|
||||
|
||||
private final ExampleAppProps exampleAppProps;
|
||||
|
||||
public Controller(ExampleAppProps exampleAppProps) {
|
||||
Controller(ExampleAppProps exampleAppProps) {
|
||||
this.exampleAppProps = exampleAppProps;
|
||||
}
|
||||
|
||||
@GetMapping("/common")
|
||||
public Response commonMessage() {
|
||||
Response commonMessage() {
|
||||
return new Response(this.exampleAppProps.getCommonMessage());
|
||||
}
|
||||
|
||||
@GetMapping("/m1")
|
||||
public Response message1() {
|
||||
Response message1() {
|
||||
return new Response(this.exampleAppProps.getMessage1());
|
||||
}
|
||||
|
||||
@GetMapping("/m2")
|
||||
public Response message2() {
|
||||
Response message2() {
|
||||
return new Response(this.exampleAppProps.getMessage2());
|
||||
}
|
||||
|
||||
@GetMapping("/m3")
|
||||
public Response message3() {
|
||||
Response message3() {
|
||||
return new Response(this.exampleAppProps.getMessage3());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Response {
|
||||
|
||||
private final String message;
|
||||
|
||||
public Response(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
record Response(String message) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.kubernetes.fabric8.config.example2;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties("bean")
|
||||
public class ExampleAppProps {
|
||||
class ExampleAppProps {
|
||||
|
||||
private String commonMessage;
|
||||
|
||||
@@ -29,35 +29,35 @@ public class ExampleAppProps {
|
||||
|
||||
private String message3;
|
||||
|
||||
public String getCommonMessage() {
|
||||
String getCommonMessage() {
|
||||
return this.commonMessage;
|
||||
}
|
||||
|
||||
public void setCommonMessage(String commonMessage) {
|
||||
void setCommonMessage(String commonMessage) {
|
||||
this.commonMessage = commonMessage;
|
||||
}
|
||||
|
||||
public String getMessage1() {
|
||||
String getMessage1() {
|
||||
return this.message1;
|
||||
}
|
||||
|
||||
public void setMessage1(String message1) {
|
||||
void setMessage1(String message1) {
|
||||
this.message1 = message1;
|
||||
}
|
||||
|
||||
public String getMessage2() {
|
||||
String getMessage2() {
|
||||
return this.message2;
|
||||
}
|
||||
|
||||
public void setMessage2(String message2) {
|
||||
void setMessage2(String message2) {
|
||||
this.message2 = message2;
|
||||
}
|
||||
|
||||
public String getMessage3() {
|
||||
String getMessage3() {
|
||||
return this.message3;
|
||||
}
|
||||
|
||||
public void setMessage3(String message3) {
|
||||
void setMessage3(String message3) {
|
||||
this.message3 = message3;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,16 +16,15 @@
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.example3;
|
||||
|
||||
/**
|
||||
* @author Haytham Mohamed
|
||||
**/
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Haytham Mohamed
|
||||
**/
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties(MultiSecretsProperties.class)
|
||||
public class MultiSecretsApp {
|
||||
@@ -35,38 +34,27 @@ public class MultiSecretsApp {
|
||||
}
|
||||
|
||||
@RestController
|
||||
public static class Controller {
|
||||
static class Controller {
|
||||
|
||||
private final MultiSecretsProperties properties;
|
||||
|
||||
public Controller(MultiSecretsProperties properties) {
|
||||
Controller(MultiSecretsProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@GetMapping("/secret1")
|
||||
public Response secret1() {
|
||||
Response secret1() {
|
||||
return new Response(this.properties.getSecret1());
|
||||
}
|
||||
|
||||
@GetMapping("/secret2")
|
||||
public Response secret2() {
|
||||
Response secret2() {
|
||||
return new Response(this.properties.getSecret2());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Response {
|
||||
|
||||
private final String secret;
|
||||
|
||||
public Response(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
public String getSecret() {
|
||||
return this.secret;
|
||||
}
|
||||
|
||||
record Response(String secret) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,25 +23,25 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
**/
|
||||
|
||||
@ConfigurationProperties("secrets")
|
||||
public class MultiSecretsProperties {
|
||||
class MultiSecretsProperties {
|
||||
|
||||
private String secret1;
|
||||
|
||||
private String secret2;
|
||||
|
||||
public String getSecret1() {
|
||||
String getSecret1() {
|
||||
return secret1;
|
||||
}
|
||||
|
||||
public void setSecret1(String secret1) {
|
||||
void setSecret1(String secret1) {
|
||||
this.secret1 = secret1;
|
||||
}
|
||||
|
||||
public String getSecret2() {
|
||||
String getSecret2() {
|
||||
return secret2;
|
||||
}
|
||||
|
||||
public void setSecret2(String secret2) {
|
||||
void setSecret2(String secret2) {
|
||||
this.secret2 = secret2;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,16 @@ import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
abstract class LabeledConfigMapWithPrefixTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
classes = LabeledConfigMapWithPrefixApp.class, properties = {
|
||||
"spring.application.name=labeled-configmap-with-prefix", "spring.main.cloud-platform=KUBERNETES" })
|
||||
abstract class LabeledConfigMapWithPrefix {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -39,7 +43,7 @@ abstract class LabeledConfigMapWithPrefixTests {
|
||||
private WebTestClient webClient;
|
||||
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
LabeledConfigMapWithPrefixTests.mockClient = mockClient;
|
||||
LabeledConfigMapWithPrefix.mockClient = mockClient;
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
|
||||
@@ -26,7 +26,7 @@ import org.springframework.cloud.kubernetes.fabric8.config.labeled_config_map_wi
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties({ One.class, Two.class, Three.class, Four.class })
|
||||
public class LabeledConfigMapWithPrefixApp {
|
||||
class LabeledConfigMapWithPrefixApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(LabeledConfigMapWithPrefixApp.class, args);
|
||||
|
||||
@@ -20,17 +20,15 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
classes = LabeledConfigMapWithPrefixApp.class,
|
||||
properties = { "spring.cloud.bootstrap.name=labeled-configmap-with-prefix",
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true",
|
||||
"spring.cloud.bootstrap.name=labeled-configmap-with-prefix" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledConfigMapWithPrefixBootstrapTests extends LabeledConfigMapWithPrefixTests {
|
||||
class LabeledConfigMapWithPrefixBootstrapTests extends LabeledConfigMapWithPrefix {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -20,17 +20,15 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
classes = LabeledConfigMapWithPrefixApp.class,
|
||||
properties = { "spring.application.name=labeled-configmap-with-prefix", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:,classpath:./labeled-configmap-with-prefix.yaml" })
|
||||
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:,classpath:./labeled-configmap-with-prefix.yaml" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledConfigMapWithPrefixConfigDataTests extends LabeledConfigMapWithPrefixTests {
|
||||
class LabeledConfigMapWithPrefixConfigDataTests extends LabeledConfigMapWithPrefix {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -26,12 +26,18 @@ import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
abstract class LabeledConfigMapWithProfileTests {
|
||||
@ActiveProfiles({ "k8s", "prod" })
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
classes = LabeledConfigMapWithProfileApp.class, properties = { "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.application.name=labeled-configmap-with-profile" })
|
||||
abstract class LabeledConfigMapWithProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -55,7 +61,7 @@ abstract class LabeledConfigMapWithProfileTests {
|
||||
* </pre>
|
||||
*/
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
LabeledConfigMapWithProfileTests.mockClient = mockClient;
|
||||
LabeledConfigMapWithProfile.mockClient = mockClient;
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
|
||||
@@ -20,19 +20,16 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@ActiveProfiles({ "k8s", "prod" })
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
classes = LabeledConfigMapWithProfileApp.class,
|
||||
properties = { "spring.cloud.bootstrap.name=labeled-configmap-with-profile",
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
|
||||
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true",
|
||||
"spring.cloud.bootstrap.name=labeled-configmap-with-profile" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledConfigMapWithProfileBootstrapTests extends LabeledConfigMapWithProfileTests {
|
||||
class LabeledConfigMapWithProfileBootstrapTests extends LabeledConfigMapWithProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -20,20 +20,15 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@ActiveProfiles({ "k8s", "prod" })
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
classes = LabeledConfigMapWithProfileApp.class,
|
||||
properties = { "spring.application.name=labeled-configmap-with-profile",
|
||||
"spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:,classpath:./labeled-configmap-with-profile.yaml" })
|
||||
|
||||
@TestPropertySource(properties = "spring.config.import=kubernetes:,classpath:./labeled-configmap-with-profile.yaml")
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledConfigMapWithProfileConfigDataTests extends LabeledConfigMapWithProfileTests {
|
||||
class LabeledConfigMapWithProfileConfigDataTests extends LabeledConfigMapWithProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -28,12 +28,15 @@ import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
abstract class LabeledSecretWithPrefixTests {
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithPrefixApp.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.application.name=labeled-secret-with-prefix" })
|
||||
abstract class LabeledSecretWithPrefix {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -41,7 +44,7 @@ abstract class LabeledSecretWithPrefixTests {
|
||||
private WebTestClient webClient;
|
||||
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
LabeledSecretWithPrefixTests.mockClient = mockClient;
|
||||
LabeledSecretWithPrefix.mockClient = mockClient;
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
|
||||
@@ -20,16 +20,16 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithPrefixApp.class,
|
||||
properties = { "spring.cloud.bootstrap.name=labeled-secret-with-prefix",
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
|
||||
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true",
|
||||
"spring.cloud.bootstrap.name=labeled-secret-with-prefix" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledSecretWithPrefixBootstrapTests extends LabeledSecretWithPrefixTests {
|
||||
class LabeledSecretWithPrefixBootstrapTests extends LabeledSecretWithPrefix {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -20,16 +20,14 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithPrefixApp.class,
|
||||
properties = { "spring.application.name=labeled-secret-with-prefix", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:,classpath:./labeled-secret-with-prefix.yaml" })
|
||||
@TestPropertySource(properties = "spring.config.import=kubernetes:,classpath:./labeled-secret-with-prefix.yaml")
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledSecretWithPrefixConfigDataTests extends LabeledSecretWithPrefixTests {
|
||||
class LabeledSecretWithPrefixConfigDataTests extends LabeledSecretWithPrefix {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -28,12 +28,17 @@ import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
abstract class LabeledSecretWithProfileTests {
|
||||
@ActiveProfiles({ "k8s", "prod" })
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithProfileApp.class,
|
||||
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.application.name=labeled-secret-with-profile" })
|
||||
abstract class LabeledSecretWithProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
@@ -57,7 +62,7 @@ abstract class LabeledSecretWithProfileTests {
|
||||
* </pre>
|
||||
*/
|
||||
static void setUpBeforeClass(KubernetesClient mockClient) {
|
||||
LabeledSecretWithProfileTests.mockClient = mockClient;
|
||||
LabeledSecretWithProfile.mockClient = mockClient;
|
||||
// Configure the kubernetes master url to point to the mock server
|
||||
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl());
|
||||
System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true");
|
||||
@@ -20,19 +20,16 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@ActiveProfiles({ "k8s", "prod" })
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithProfileApp.class,
|
||||
properties = { "spring.cloud.bootstrap.name=labeled-secret-with-profile",
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true",
|
||||
"spring.cloud.kubernetes.config.enabled=false" })
|
||||
|
||||
@TestPropertySource(properties = { "spring.cloud.bootstrap.enabled=true",
|
||||
"spring.cloud.kubernetes.config.enabled=false", "spring.cloud.bootstrap.name=labeled-secret-with-profile" })
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledSecretWithProfileBootstrapTests extends LabeledSecretWithProfileTests {
|
||||
class LabeledSecretWithProfileBootstrapTests extends LabeledSecretWithProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -20,19 +20,15 @@ import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
*/
|
||||
@ActiveProfiles({ "k8s", "prod" })
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithProfileApp.class,
|
||||
properties = { "spring.application.name=labeled-secret-with-profile", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:,classpath:./labeled-secret-with-profile.yaml",
|
||||
"spring.cloud.kubernetes.config.enabled=false" })
|
||||
|
||||
@TestPropertySource(properties = "spring.config.import=kubernetes:,classpath:./labeled-secret-with-profile.yaml")
|
||||
@EnableKubernetesMockClient(crud = true, https = false)
|
||||
class LabeledSecretWithProfileConfigDataTests extends LabeledSecretWithProfileTests {
|
||||
class LabeledSecretWithProfileConfigDataTests extends LabeledSecretWithProfile {
|
||||
|
||||
private static KubernetesClient mockClient;
|
||||
|
||||
|
||||
@@ -14,25 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_fail_fast_disabled;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Isik Erhan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" },
|
||||
classes = Application.class)
|
||||
@TestPropertySource(properties = "spring.cloud.bootstrap.enabled=true")
|
||||
@EnableKubernetesMockClient
|
||||
class ConfigDataConfigFailFastDisabled extends ConfigFailFastDisabled {
|
||||
class BoostrapConfigFailFastDisabledTests extends ConfigFailFastDisabled {
|
||||
|
||||
private static KubernetesMockServer mockServer;
|
||||
|
||||
@@ -14,25 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_fail_fast_disabled;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Isik Erhan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" },
|
||||
classes = Application.class)
|
||||
@TestPropertySource(properties = "spring.config.import=kubernetes:")
|
||||
@EnableKubernetesMockClient
|
||||
class BoostrapConfigFailFastDisabled extends ConfigFailFastDisabled {
|
||||
class ConfigDataConfigFailFastDisabledTests extends ConfigFailFastDisabled {
|
||||
|
||||
private static KubernetesMockServer mockServer;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_fail_fast_disabled;
|
||||
|
||||
import io.fabric8.kubernetes.client.Config;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
@@ -23,7 +23,9 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Fabric8ConfigMapPropertySourceLocator;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -34,6 +36,9 @@ import static org.mockito.Mockito.verify;
|
||||
/**
|
||||
* @author Isik Erhan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES" },
|
||||
classes = TestApplication.class)
|
||||
abstract class ConfigFailFastDisabled {
|
||||
|
||||
private static final String API = "/api/v1/namespaces/default/configmaps/application";
|
||||
@@ -14,30 +14,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_retry_disabled_sercrets_enabled;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Isik Erhan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default",
|
||||
"spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false",
|
||||
"spring.cloud.kubernetes.secrets.fail-fast=true", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.cloud.bootstrap.enabled=true" },
|
||||
classes = Application.class)
|
||||
@TestPropertySource(properties = "spring.cloud.bootstrap.enabled=true")
|
||||
@EnableKubernetesMockClient
|
||||
class BoostrapConfigRetryDisabledButSecretsRetryEnabled extends ConfigRetryDisabledButSecretsRetryEnabled {
|
||||
class BoostrapConfigRetryDisabledButSecretsRetryEnabledTests extends ConfigRetryDisabledButSecretsRetryEnabled {
|
||||
|
||||
private static KubernetesMockServer mockServer;
|
||||
|
||||
@@ -14,31 +14,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_retry_disabled_sercrets_enabled;
|
||||
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
|
||||
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.commons.config.ConfigDataRetryableSecretsPropertySourceLocator;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Isik Erhan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default",
|
||||
"spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false",
|
||||
"spring.cloud.kubernetes.secrets.fail-fast=true", "spring.main.cloud-platform=KUBERNETES",
|
||||
"spring.config.import=kubernetes:" },
|
||||
classes = Application.class)
|
||||
|
||||
@TestPropertySource(properties = { "spring.config.import=kubernetes:" })
|
||||
@EnableKubernetesMockClient
|
||||
class ConfigDataConfigRetryDisabledButSecretsRetryEnabled extends ConfigRetryDisabledButSecretsRetryEnabled {
|
||||
class ConfigDataConfigRetryDisabledButSecretsRetryEnabledTests extends ConfigRetryDisabledButSecretsRetryEnabled {
|
||||
|
||||
private static KubernetesMockServer mockServer;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry;
|
||||
package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_retry_disabled_sercrets_enabled;
|
||||
|
||||
import io.fabric8.kubernetes.api.model.ConfigMapListBuilder;
|
||||
import io.fabric8.kubernetes.client.Config;
|
||||
@@ -23,7 +23,9 @@ import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Fabric8ConfigMapPropertySourceLocator;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.TestApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
@@ -36,6 +38,11 @@ import static org.mockito.Mockito.verify;
|
||||
/**
|
||||
* @author Isik Erhan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default",
|
||||
"spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false",
|
||||
"spring.cloud.kubernetes.secrets.fail-fast=true", "spring.main.cloud-platform=KUBERNETES" },
|
||||
classes = TestApplication.class)
|
||||
abstract class ConfigRetryDisabledButSecretsRetryEnabled {
|
||||
|
||||
private static final String API = "/api/v1/namespaces/default/configmaps";
|
||||
@@ -22,21 +22,16 @@ import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Application;
|
||||
import org.springframework.cloud.kubernetes.fabric8.config.Fabric8ConfigMapPropertySourceLocator;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
/**
|
||||
* @author Isik Erhan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.cloud.kubernetes.client.namespace=default",
|
||||
"spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.max-attempts=5",
|
||||
"spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" },
|
||||
classes = Application.class)
|
||||
@TestPropertySource(properties = "spring.cloud.bootstrap.enabled=true")
|
||||
@EnableKubernetesMockClient
|
||||
class BoostrapConfigRetryEnabled extends ConfigRetryEnabled {
|
||||
class BoostrapConfigRetryEnabledTests extends ConfigRetryEnabled {
|
||||
|
||||
private static KubernetesMockServer mockServer;
|
||||
|
||||
@@ -51,7 +46,7 @@ class BoostrapConfigRetryEnabled extends ConfigRetryEnabled {
|
||||
Fabric8ConfigMapPropertySourceLocator propertySourceLocator;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
void beforeEach() {
|
||||
psl = propertySourceLocator;
|
||||
verifiablePsl = propertySourceLocator;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user