Skip to content

Commit

Permalink
Removed the vehicle sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
AsakerMohd committed May 31, 2024
1 parent 461207b commit cc766dd
Show file tree
Hide file tree
Showing 61 changed files with 63 additions and 2,341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

// TODO: The vehicle sample app doesn't exist anymore so this needs to be cleaned up
public class ImageServiceContainer {

private static final Logger logger = LoggerFactory.getLogger(ImageServiceContainer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,72 +20,72 @@
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

// TODO: The vehicle sample app doesn't exist anymore so this needs to be cleaned up
public class VehicleInventoryServiceContainer {

private static final Logger logger =
LoggerFactory.getLogger(VehicleInventoryServiceContainer.class);
private static final int PORT = 8001;
private static final Logger logger = LoggerFactory.getLogger(VehicleInventoryServiceContainer.class);
private static final int PORT = 8001;

private final Network network;
private final Startable collector;
private final DistroConfig distroConfig;
private final NamingConventions namingConventions;
private final Network network;
private final Startable collector;
private final DistroConfig distroConfig;
private final NamingConventions namingConventions;

public VehicleInventoryServiceContainer(
Network network,
Startable collector,
DistroConfig distroConfig,
NamingConventions namingConventions) {
this.network = network;
this.collector = collector;
this.distroConfig = distroConfig;
this.namingConventions = namingConventions;
}
public VehicleInventoryServiceContainer(
Network network,
Startable collector,
DistroConfig distroConfig,
NamingConventions namingConventions) {
this.network = network;
this.collector = collector;
this.distroConfig = distroConfig;
this.namingConventions = namingConventions;
}

public GenericContainer<?> build() {
GenericContainer<?> container =
new GenericContainer<>(DockerImageName.parse("performance-test/vehicle-inventory-service"))
.withNetwork(network)
.withNetworkAliases("vehicle-service")
.withLogConsumer(new Slf4jLogConsumer(logger))
.withExposedPorts(PORT)
.waitingFor(Wait.forHttp("/vehicle-inventory/health-check").forPort(PORT))
.withFileSystemBind(
namingConventions.localResults(), namingConventions.containerResults())
.withCopyFileToContainer(
MountableFile.forClasspathResource("runVehicleInventory.sh"),
"vehicle-inventory-app/run.sh")
.withCopyFileToContainer(
MountableFile.forClasspathResource("profiler.py"),
"vehicle-inventory-app/profiler.py")
.withCopyFileToContainer(
MountableFile.forClasspathResource("executeProfiler.sh"),
"vehicle-inventory-app/executeProfiler.sh")
.withEnv("DJANGO_SETTINGS_MODULE", "VehicleInventoryApp.settings")
.withEnv("PORT", Integer.toString(PORT))
.withEnv("POSTGRES_DATABASE", PostgresContainer.DATABASE_NAME)
.withEnv("POSTGRES_USER", PostgresContainer.USERNAME)
.withEnv("POSTGRES_PASSWORD", PostgresContainer.PASSWORD)
.withEnv("DB_SERVICE_HOST", PostgresContainer.NETWORK_ALIAS)
.withEnv("DB_SERVICE_PORT", Integer.toString(PostgreSQLContainer.POSTGRESQL_PORT))
.withEnv("IMAGE_BACKEND_SERVICE_HOST", ImageServiceContainer.NETWORK_ALIAS)
.withEnv("IMAGE_BACKEND_SERVICE_PORT", Integer.toString(ImageServiceContainer.PORT))
.withEnv(distroConfig.getAdditionalEnvVars())
.dependsOn(collector)
.withCreateContainerCmdModifier(
cmd -> cmd.getHostConfig().withCpusetCpus(RuntimeUtil.getApplicationCores()))
.withCommand("bash run.sh");
public GenericContainer<?> build() {
GenericContainer<?> container = new GenericContainer<>(
DockerImageName.parse("performance-test/vehicle-inventory-service"))
.withNetwork(network)
.withNetworkAliases("vehicle-service")
.withLogConsumer(new Slf4jLogConsumer(logger))
.withExposedPorts(PORT)
.waitingFor(Wait.forHttp("/vehicle-inventory/health-check").forPort(PORT))
.withFileSystemBind(
namingConventions.localResults(), namingConventions.containerResults())
.withCopyFileToContainer(
MountableFile.forClasspathResource("runVehicleInventory.sh"),
"vehicle-inventory-app/run.sh")
.withCopyFileToContainer(
MountableFile.forClasspathResource("profiler.py"),
"vehicle-inventory-app/profiler.py")
.withCopyFileToContainer(
MountableFile.forClasspathResource("executeProfiler.sh"),
"vehicle-inventory-app/executeProfiler.sh")
.withEnv("DJANGO_SETTINGS_MODULE", "VehicleInventoryApp.settings")
.withEnv("PORT", Integer.toString(PORT))
.withEnv("POSTGRES_DATABASE", PostgresContainer.DATABASE_NAME)
.withEnv("POSTGRES_USER", PostgresContainer.USERNAME)
.withEnv("POSTGRES_PASSWORD", PostgresContainer.PASSWORD)
.withEnv("DB_SERVICE_HOST", PostgresContainer.NETWORK_ALIAS)
.withEnv("DB_SERVICE_PORT", Integer.toString(PostgreSQLContainer.POSTGRESQL_PORT))
.withEnv("IMAGE_BACKEND_SERVICE_HOST", ImageServiceContainer.NETWORK_ALIAS)
.withEnv("IMAGE_BACKEND_SERVICE_PORT", Integer.toString(ImageServiceContainer.PORT))
.withEnv(distroConfig.getAdditionalEnvVars())
.dependsOn(collector)
.withCreateContainerCmdModifier(
cmd -> cmd.getHostConfig().withCpusetCpus(RuntimeUtil.getApplicationCores()))
.withCommand("bash run.sh");

if (distroConfig.doInstrument()) {
container
.withEnv("DO_INSTRUMENT", "true")
.withEnv("OTEL_TRACES_EXPORTER", "otlp")
.withEnv("OTEL_METRICS_EXPORTER", "none")
.withEnv("OTEL_IMR_EXPORT_INTERVAL", "5000")
.withEnv("OTEL_EXPORTER_OTLP_INSECURE", "true")
.withEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://collector:4317")
.withEnv("OTEL_RESOURCE_ATTRIBUTES", "service.name=vehicle_inventory_service");
if (distroConfig.doInstrument()) {
container
.withEnv("DO_INSTRUMENT", "true")
.withEnv("OTEL_TRACES_EXPORTER", "otlp")
.withEnv("OTEL_METRICS_EXPORTER", "none")
.withEnv("OTEL_IMR_EXPORT_INTERVAL", "5000")
.withEnv("OTEL_EXPORTER_OTLP_INSECURE", "true")
.withEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://collector:4317")
.withEnv("OTEL_RESOURCE_ATTRIBUTES", "service.name=vehicle_inventory_service");
}
return container;
}
return container;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit cc766dd

Please sign in to comment.