From bdcbecbddbfc1b2b93ba53773f1eca7a0ca63ebc Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Mon, 26 Feb 2024 15:42:27 +0000 Subject: [PATCH] used a constant --- .../docker/docker_kurtosis_backend/consts/consts.go | 2 ++ ...docker_kurtosis_backend_api_container_functions.go | 5 ++--- .../engine_functions/create_engine.go | 11 +++++------ .../traefik/traefik_container_config_provider.go | 5 ++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go index a3210874ea..a13632c54e 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go @@ -33,6 +33,8 @@ const ( HttpApplicationProtocol = "http" GitHubAuthStorageDirPath = "/kurtosis-data/github-auth/" + + EmptyApplicationURL = "" ) // This maps a Docker container's status to a binary "is the container considered running?" determiner diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/docker_kurtosis_backend_api_container_functions.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/docker_kurtosis_backend_api_container_functions.go index e7f0cbf9f4..76d99a9832 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/docker_kurtosis_backend_api_container_functions.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/docker_kurtosis_backend_api_container_functions.go @@ -33,7 +33,6 @@ const ( timeBetweenWaitForApiContainerAvailabilityRetries = 1 * time.Second apicDebugServerPort = 50103 // in ClI this is 50101 and in engine is 50102 - emptyUrl = "" ) // TODO: MIGRATE THIS FOLDER TO USE STRUCTURE OF USER_SERVICE_FUNCTIONS MODULE @@ -130,7 +129,7 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer( return nil, stacktrace.Propagate(err, "An error occurred creating a new wait with default values") } - privateGrpcPortSpec, err := port_spec.NewPortSpec(grpcPortNum, apiContainerTransportProtocol, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + privateGrpcPortSpec, err := port_spec.NewPortSpec(grpcPortNum, apiContainerTransportProtocol, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, @@ -164,7 +163,7 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer( } if shouldStartInDebugMode { - debugServerPortSpec, err := port_spec.NewPortSpec(uint16(apicDebugServerPort), apiContainerTransportProtocol, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + debugServerPortSpec, err := port_spec.NewPortSpec(uint16(apicDebugServerPort), apiContainerTransportProtocol, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/create_engine.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/create_engine.go index 7df838bce6..5d3db73446 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/create_engine.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/create_engine.go @@ -32,7 +32,6 @@ const ( maxWaitForEngineAvailabilityRetries = 10 timeBetweenWaitForEngineAvailabilityRetries = 1 * time.Second logsStorageDirPath = "/var/log/kurtosis/" - emptyUrl = "" ) func CreateEngine( @@ -65,7 +64,7 @@ func CreateEngine( return nil, stacktrace.Propagate(err, "An error occurred creating a wait with default values") } - privateGrpcPortSpec, err := port_spec.NewPortSpec(grpcPortNum, consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + privateGrpcPortSpec, err := port_spec.NewPortSpec(grpcPortNum, consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, @@ -138,7 +137,7 @@ func CreateEngine( } logrus.Infof("Reverse proxy started.") - enclaveManagerUIPortSpec, err := port_spec.NewPortSpec(uint16(enclaveManagerUIPort), consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + enclaveManagerUIPortSpec, err := port_spec.NewPortSpec(uint16(enclaveManagerUIPort), consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, @@ -148,7 +147,7 @@ func CreateEngine( ) } - enclaveManagerApiPortSpec, err := port_spec.NewPortSpec(uint16(enclaveManagerAPIPort), consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + enclaveManagerApiPortSpec, err := port_spec.NewPortSpec(uint16(enclaveManagerAPIPort), consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, @@ -158,7 +157,7 @@ func CreateEngine( ) } - restAPIPortSpec, err := port_spec.NewPortSpec(engine.RESTAPIPortAddr, consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + restAPIPortSpec, err := port_spec.NewPortSpec(engine.RESTAPIPortAddr, consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, @@ -213,7 +212,7 @@ func CreateEngine( // Configure the debug port only if it's required if shouldStartInDebugMode { - debugServerPortSpec, err := port_spec.NewPortSpec(uint16(engineDebugServerPort), consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + debugServerPortSpec, err := port_spec.NewPortSpec(uint16(engineDebugServerPort), consts.EngineTransportProtocol, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/implementations/traefik/traefik_container_config_provider.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/implementations/traefik/traefik_container_config_provider.go index 26939abdbe..70d88a854b 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/implementations/traefik/traefik_container_config_provider.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/implementations/traefik/traefik_container_config_provider.go @@ -17,7 +17,6 @@ const ( printfCmdName = "printf" mkdirCmdName = "mkdir" shCmdFlag = "-c" - emptyUrl = "" ) type traefikContainerConfigProvider struct { @@ -72,7 +71,7 @@ func (traefik *traefikContainerConfigProvider) GetContainerArgs( } // Publish HTTP and Dashboard entrypoint ports - privateHttpPortSpec, err := port_spec.NewPortSpec(httpPort, port_spec.TransportProtocol_TCP, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + privateHttpPortSpec, err := port_spec.NewPortSpec(httpPort, port_spec.TransportProtocol_TCP, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err, @@ -85,7 +84,7 @@ func (traefik *traefikContainerConfigProvider) GetContainerArgs( if err != nil { return nil, stacktrace.Propagate(err, "An error occurred transforming the private http port spec to a Docker port") } - privateDashboardPortSpec, err := port_spec.NewPortSpec(dashboardPort, port_spec.TransportProtocol_TCP, consts.HttpApplicationProtocol, defaultWait, emptyUrl) + privateDashboardPortSpec, err := port_spec.NewPortSpec(dashboardPort, port_spec.TransportProtocol_TCP, consts.HttpApplicationProtocol, defaultWait, consts.EmptyApplicationURL) if err != nil { return nil, stacktrace.Propagate( err,