deploy: parameterize portainer image prefix
This commit is contained in:
@@ -39,6 +39,27 @@ class PortainerComposeResourceLimitsTest {
|
||||
assertServiceMemoryLimit(compose, "vehicle-analytics-app", "VEHICLE_ANALYTICS_MEM_LIMIT", "1024m");
|
||||
}
|
||||
|
||||
@Test
|
||||
void productionImagesShareOverridableRegistryAndNamespace() throws IOException {
|
||||
String compose = Files.readString(repositoryRoot().resolve("deploy/portainer/docker-compose.yml"));
|
||||
String registry = "${LINGNIU_IMAGE_REGISTRY:-crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com}";
|
||||
String namespace = "${LINGNIU_IMAGE_NAMESPACE:-oneos}";
|
||||
|
||||
for (String serviceName : List.of(
|
||||
"gb32960-ingest-app",
|
||||
"jt808-ingest-app",
|
||||
"yutong-mqtt-app",
|
||||
"vehicle-history-app",
|
||||
"vehicle-analytics-app")) {
|
||||
assertThat(serviceBlock(compose, serviceName))
|
||||
.contains("image: " + registry + "/" + namespace + "/" + serviceName
|
||||
+ ":${LINGNIU_IMAGE_VERSION:?set LINGNIU_IMAGE_VERSION}");
|
||||
}
|
||||
assertThat(countOccurrences(compose, "image: crpi-85r4m0ackrm3qpje"))
|
||||
.isZero();
|
||||
assertThat(countOccurrences(compose, "/oneos/")).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
void portainerServicesUseContainerReadinessHealthchecks() throws IOException {
|
||||
String compose = Files.readString(repositoryRoot().resolve("deploy/portainer/docker-compose.yml"));
|
||||
@@ -490,6 +511,16 @@ class PortainerComposeResourceLimitsTest {
|
||||
return compose.substring(start, end);
|
||||
}
|
||||
|
||||
private static int countOccurrences(String text, String needle) {
|
||||
int count = 0;
|
||||
int index = 0;
|
||||
while ((index = text.indexOf(needle, index)) >= 0) {
|
||||
count++;
|
||||
index += needle.length();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static Properties yamlProperties(Path path) {
|
||||
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
|
||||
factory.setResources(new FileSystemResource(path));
|
||||
|
||||
Reference in New Issue
Block a user