diff --git a/.make/docker.mk b/.make/docker.mk index 34d28a1..3d599f7 100644 --- a/.make/docker.mk +++ b/.make/docker.mk @@ -84,7 +84,7 @@ else -t \ $(DOCKER_RUN_INTERACTIVE_SWITCH) \ --name="$(DOCKER_CONTAINER_NAME)" \ - -e CLUSTER_POSTGRES_PORT=5432 \ + -e F8CLUSTER_POSTGRES_PORT=5432 \ -v $(CUR_DIR):$(PACKAGE_PATH):Z \ -u $(shell id -u $(USER)):$(shell id -g $(USER)) \ -e GOPATH=$(GOPATH_IN_CONTAINER) \ @@ -114,8 +114,8 @@ endif ifeq ($(strip $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' make_postgres_integration_test_1 2>/dev/null)),) $(error Failed to find PostgreSQL container. Try running "make integration-test-env-prepare") endif - $(eval CLUSTER_POSTGRES_HOST := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' make_postgres_integration_test_1 2>/dev/null)) - docker exec -t $(DOCKER_RUN_INTERACTIVE_SWITCH) "$(DOCKER_CONTAINER_NAME)" bash -ec 'export CLUSTER_POSTGRES_HOST=$(CLUSTER_POSTGRES_HOST); make $(makecommand)' + $(eval F8CLUSTER_POSTGRES_HOST := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' make_postgres_integration_test_1 2>/dev/null)) + docker exec -t $(DOCKER_RUN_INTERACTIVE_SWITCH) "$(DOCKER_CONTAINER_NAME)" bash -ec 'export F8CLUSTER_POSTGRES_HOST=$(F8CLUSTER_POSTGRES_HOST); make $(makecommand)' # This is a wildcard target to let you call any make target from the normal makefile # but it will run inside the docker container. This target will only get executed if diff --git a/.make/test.mk b/.make/test.mk index b07e319..e39e988 100644 --- a/.make/test.mk +++ b/.make/test.mk @@ -94,9 +94,9 @@ GO_TEST_VERBOSITY_FLAG ?= # By default use the "localhost" or specify manually during make invocation: # -# CLUSTER_POSTGRES_HOST=somehost make test-integration +# F8CLUSTER_POSTGRES_HOST=somehost make test-integration # -CLUSTER_POSTGRES_HOST ?= localhost +F8CLUSTER_POSTGRES_HOST ?= localhost # By default reduce the amount of log output from tests F8_LOG_LEVEL ?= error @@ -147,7 +147,7 @@ test-unit-with-coverage: prebuild-check clean-coverage-unit $(COV_PATH_UNIT) test-unit: prebuild-check $(SOURCES) $(call log-info,"Running test: $@") $(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN))) - CLUSTER_DEVELOPER_MODE_ENABLED=1 CLUSTER_RESOURCE_UNIT_TEST=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) + F8CLUSTER_DEVELOPER_MODE_ENABLED=1 F8CLUSTER_RESOURCE_UNIT_TEST=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) .PHONY: test-unit-junit test-unit-junit: prebuild-check ${GO_JUNIT_BIN} ${TMP_PATH} @@ -164,12 +164,12 @@ test-integration-with-coverage: prebuild-check clean-coverage-integration migrat test-integration: prebuild-check migrate-database $(SOURCES) $(call log-info,"Running test: $@") $(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN))) - CLUSTER_DEVELOPER_MODE_ENABLED=1 CLUSTER_RESOURCE_DATABASE=1 CLUSTER_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) + F8CLUSTER_DEVELOPER_MODE_ENABLED=1 F8CLUSTER_RESOURCE_DATABASE=1 F8CLUSTER_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) test-integration-benchmark: prebuild-check migrate-database $(SOURCES) $(call log-info,"Running benchmarks: $@") $(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN))) - CLUSTER_DEVELOPER_MODE_ENABLED=1 CLUSTER_LOG_LEVEL=error CLUSTER_RESOURCE_DATABASE=1 CLUSTER_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -run=^$$ -bench=. -cpu 1,2,4 -test.benchmem $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) + F8CLUSTER_DEVELOPER_MODE_ENABLED=1 F8CLUSTER_LOG_LEVEL=error F8CLUSTER_RESOURCE_DATABASE=1 F8CLUSTER_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -run=^$$ -bench=. -cpu 1,2,4 -test.benchmem $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) .PHONY: test-remote-with-coverage ## Runs the remote tests and produces coverage files for each package. @@ -180,13 +180,13 @@ test-remote-with-coverage: prebuild-check clean-coverage-remote $(COV_PATH_REMOT test-remote: prebuild-check $(SOURCES) $(call log-info,"Running test: $@") $(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN))) - CLUSTER_DEVELOPER_MODE_ENABLED=1 CLUSTER_RESOURCE_REMOTE=1 CLUSTER_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) + F8CLUSTER_DEVELOPER_MODE_ENABLED=1 F8CLUSTER_RESOURCE_REMOTE=1 F8CLUSTER_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) .PHONY: test-migration ## Runs the migration tests and should be executed before running the integration tests ## in order to have a clean database test-migration: prebuild-check - CLUSTER_RESOURCE_DATABASE=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) github.com/fabric8-services/fabric8-cluster/migration + F8CLUSTER_RESOURCE_DATABASE=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) github.com/fabric8-services/fabric8-cluster/migration # Downloads docker-compose to tmp/docker-compose if it does not already exist. define download-docker-compose @@ -422,7 +422,7 @@ $(eval ENV_VAR := $(5)) $(eval ALL_PKGS_COMMA_SEPARATED := $(6)) @mkdir -p $(COV_DIR)/$(PACKAGE_NAME); $(eval COV_OUT_FILE := $(COV_DIR)/$(PACKAGE_NAME)/coverage.$(TEST_NAME).mode-$(COVERAGE_MODE)) -@$(ENV_VAR) CLUSTER_DEVELOPER_MODE_ENABLED=1 CLUSTER_POSTGRES_HOST=$(CLUSTER_POSTGRES_HOST) F8_LOG_LEVEL=$(F8_LOG_LEVEL) \ +@$(ENV_VAR) F8CLUSTER_DEVELOPER_MODE_ENABLED=1 F8CLUSTER_POSTGRES_HOST=$(F8CLUSTER_POSTGRES_HOST) F8_LOG_LEVEL=$(F8_LOG_LEVEL) \ go test $(PACKAGE_NAME) \ $(GO_TEST_VERBOSITY_FLAG) \ -coverprofile $(COV_OUT_FILE) \ @@ -482,7 +482,7 @@ $(COV_PATH_INTEGRATION): $(SOURCES) $(GOCOVMERGE_BIN) @-rm -f $(ERRORS_FILE) $(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN))) $(eval ALL_PKGS_COMMA_SEPARATED:=$(shell echo $(TEST_PACKAGES) | tr ' ' ,)) - $(foreach package, $(TEST_PACKAGES), $(call test-package,$(TEST_NAME),$(package),$(COV_PATH_INTEGRATION),$(ERRORS_FILE),CLUSTER_RESOURCE_DATABASE=1 CLUSTER_RESOURCE_UNIT_TEST=0,$(ALL_PKGS_COMMA_SEPARATED))) + $(foreach package, $(TEST_PACKAGES), $(call test-package,$(TEST_NAME),$(package),$(COV_PATH_INTEGRATION),$(ERRORS_FILE),F8CLUSTER_RESOURCE_DATABASE=1 F8CLUSTER_RESOURCE_UNIT_TEST=0,$(ALL_PKGS_COMMA_SEPARATED))) $(call check-test-results,$(ERRORS_FILE)) # NOTE: We don't have prebuild-check as a dependency here because it would cause diff --git a/Dockerfile.deploy b/Dockerfile.deploy index 84eff23..dc0de64 100644 --- a/Dockerfile.deploy +++ b/Dockerfile.deploy @@ -2,14 +2,14 @@ FROM centos:7 LABEL maintainer "Devtools " LABEL author "Konrad Kleine " ENV LANG=en_US.utf8 -ENV CLUSTER_INSTALL_PREFIX=/usr/local/cluster +ENV F8CLUSTER_INSTALL_PREFIX=/usr/local/cluster # Create a non-root user and a group with the same name: "cluster" -ENV CLUSTER_USER_NAME=cluster -RUN useradd --no-create-home -s /bin/bash ${CLUSTER_USER_NAME} +ENV F8CLUSTER_USER_NAME=cluster +RUN useradd --no-create-home -s /bin/bash ${F8CLUSTER_USER_NAME} -COPY bin/cluster ${CLUSTER_INSTALL_PREFIX}/bin/cluster -COPY config.yaml ${CLUSTER_INSTALL_PREFIX}/etc/config.yaml +COPY bin/cluster ${F8CLUSTER_INSTALL_PREFIX}/bin/cluster +COPY config.yaml ${F8CLUSTER_INSTALL_PREFIX}/etc/config.yaml # Install little pcp pmcd server for metrics collection # would prefer only pmcd, and not the /bin/pm*tools etc. @@ -23,9 +23,9 @@ EXPOSE 44321 # From here onwards, any RUN, CMD, or ENTRYPOINT will be run under the following user -USER ${CLUSTER_USER_NAME} +USER ${F8CLUSTER_USER_NAME} -WORKDIR ${CLUSTER_INSTALL_PREFIX} +WORKDIR ${F8CLUSTER_INSTALL_PREFIX} ENTRYPOINT [ "/cluster+pmcd.sh" ] EXPOSE 8087 diff --git a/Dockerfile.deploy.rhel b/Dockerfile.deploy.rhel index 614ce12..e9439f6 100644 --- a/Dockerfile.deploy.rhel +++ b/Dockerfile.deploy.rhel @@ -3,22 +3,22 @@ FROM quay.io/openshiftio/rhel-base-golang:latest LABEL maintainer "Devtools " LABEL author "Devtools " ENV LANG=en_US.utf8 -ENV CLUSTER_INSTALL_PREFIX=/usr/local/cluster +ENV F8CLUSTER_INSTALL_PREFIX=/usr/local/cluster # Create a non-root user and a group with the same name: "cluster" -ENV CLUSTER_USER_NAME=cluster -RUN useradd --no-create-home -s /bin/bash ${CLUSTER_USER_NAME} +ENV F8CLUSTER_USER_NAME=cluster +RUN useradd --no-create-home -s /bin/bash ${F8CLUSTER_USER_NAME} -COPY bin/cluster ${CLUSTER_INSTALL_PREFIX}/bin/cluster -COPY config.yaml ${CLUSTER_INSTALL_PREFIX}/etc/config.yaml +COPY bin/cluster ${F8CLUSTER_INSTALL_PREFIX}/bin/cluster +COPY config.yaml ${F8CLUSTER_INSTALL_PREFIX}/etc/config.yaml COPY ./cluster+pmcd.sh /cluster+pmcd.sh EXPOSE 44321 # From here onwards, any RUN, CMD, or ENTRYPOINT will be run under the following user -USER ${CLUSTER_USER_NAME} +USER ${F8CLUSTER_USER_NAME} -WORKDIR ${CLUSTER_INSTALL_PREFIX} +WORKDIR ${F8CLUSTER_INSTALL_PREFIX} ENTRYPOINT [ "/cluster+pmcd.sh" ] EXPOSE 8087 diff --git a/Gopkg.lock b/Gopkg.lock index 50cc5fe..46b52f3 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -365,20 +365,9 @@ [[projects]] name = "golang.org/x/net" - packages = [ - "context", - "websocket" - ] + packages = ["websocket"] revision = "b1a2d6e8c8b5fc8f601ead62536f02a8e1b6217d" -[[projects]] - name = "golang.org/x/oauth2" - packages = [ - ".", - "internal" - ] - revision = "da3ce8d62a7f77aadfda06cb82bd604d6469c645" - [[projects]] name = "golang.org/x/sys" packages = ["unix"] @@ -406,19 +395,6 @@ ] revision = "a888bfdffa4526cc6987572bca9a2c6b7758290f" -[[projects]] - name = "google.golang.org/appengine" - packages = [ - "internal", - "internal/base", - "internal/datastore", - "internal/log", - "internal/remote_api", - "internal/urlfetch", - "urlfetch" - ] - revision = "ca59ef35f409df61fa4a5f8290ff289b37eccfb8" - [[projects]] name = "gopkg.in/square/go-jose.v2" packages = [ @@ -437,6 +413,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "de870cfe9c2bae6bfbc25455c98b65da04a1e3c530b08e6eaa1c45725a5fb714" + inputs-digest = "92ef3e88c05b2458aecc43d85572f62d7d0e94851eda9380eca70989efdabb5b" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Makefile b/Makefile index ec340dd..aedc263 100644 --- a/Makefile +++ b/Makefile @@ -278,7 +278,7 @@ regenerate: clean-generated generate .PHONY: dev dev: prebuild-check deps generate $(FRESH_BIN) docker-compose up -d db - CLUSTER_DEVELOPER_MODE_ENABLED=true $(FRESH_BIN) + F8CLUSTER_DEVELOPER_MODE_ENABLED=true $(FRESH_BIN) include ./.make/test.mk diff --git a/README.adoc b/README.adoc index 4bd63ed..0998a97 100644 --- a/README.adoc +++ b/README.adoc @@ -178,9 +178,9 @@ $ cd $GOPATH/src/github.com/fabric8-services/fabric8-cluster $ make test-all ---- -By default, test data is removed from the database after each test, unless the `CLUSTER_CLEAN_TEST_DATA` environment variable is set to `false`. This can be particularily useful to run queries on the test data after a test failure, in order to understand why the result did not match the expectations. +By default, test data is removed from the database after each test, unless the `F8CLUSTER_CLEAN_TEST_DATA` environment variable is set to `false`. This can be particularily useful to run queries on the test data after a test failure, in order to understand why the result did not match the expectations. -Also, all SQL queries can be displayed in the output if the `CLUSTER_ENABLE_DB_LOGS` environment variable is set to `true. Beware that this can be very verbose, though ;) +Also, all SQL queries can be displayed in the output if the `F8CLUSTER_ENABLE_DB_LOGS` environment variable is set to `true. Beware that this can be very verbose, though ;) ===== Coverage [[coverage]] @@ -272,7 +272,7 @@ The database are kept in a docker container that gets reused between restarts. T To clear out the database kill the database like this: ---- -$ docker kill fabric8CLUSTER_db_1 && docker rm fabric8CLUSTER_db_1 +$ docker kill fabric8F8CLUSTER_db_1 && docker rm fabric8F8CLUSTER_db_1 ---- In case you have mulitple `fabric8*` running use `docker ps` to locate the container name. diff --git a/application/repository/repositories.go b/application/repository/repositories.go index 1e9145a..ded4fc1 100644 --- a/application/repository/repositories.go +++ b/application/repository/repositories.go @@ -1,7 +1,5 @@ package repository -import () - //Repositories stands for a particular implementation of the business logic of our application type Repositories interface { //Identities() account.IdentityRepository diff --git a/configuration/configuration.go b/configuration/configuration.go index cdb4b3e..6d7ad40 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -111,7 +111,7 @@ func NewConfigurationData(mainConfigFile string, osoClusterConfigFile string) (* } // Set up the main configuration - c.v.SetEnvPrefix("CLUSTER") + c.v.SetEnvPrefix("F8CLUSTER") c.v.AutomaticEnv() c.v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) c.v.SetTypeByDefaultValue(true) @@ -326,12 +326,12 @@ func pathExists(pathToCheck string) (string, error) { func getMainConfigFile() string { // This was either passed as a env var or set inside main.go from --config - envConfigPath, _ := os.LookupEnv("CLUSTER_CONFIG_FILE_PATH") + envConfigPath, _ := os.LookupEnv("F8CLUSTER_CONFIG_FILE_PATH") return envConfigPath } func getOSOClusterConfigFile() string { - envOSOClusterConfigFile, _ := os.LookupEnv("CLUSTER_OSO_CLUSTER_CONFIG_FILE") + envOSOClusterConfigFile, _ := os.LookupEnv("F8CLUSTER_OSO_CLUSTER_CONFIG_FILE") return envOSOClusterConfigFile } @@ -665,7 +665,7 @@ func (c *ConfigurationData) IsLogJSON() bool { // GetEnvironment returns the current environment application is deployed in // like 'production', 'prod-preview', 'local', etc as the value of environment variable -// `CLUSTER_ENVIRONMENT` is set. +// `F8CLUSTER_ENVIRONMENT` is set. func (c *ConfigurationData) GetEnvironment() string { return c.v.GetString(varEnvironment) } diff --git a/configuration/configuration_blackbox_test.go b/configuration/configuration_blackbox_test.go index 0835f57..3db7b10 100644 --- a/configuration/configuration_blackbox_test.go +++ b/configuration/configuration_blackbox_test.go @@ -47,8 +47,8 @@ func resetConfiguration() { func TestGetEnvironmentOK(t *testing.T) { resource.Require(t, resource.UnitTest) - constAuthEnvironment := "CLUSTER_ENVIRONMENT" - constAuthSentryDSN := "CLUSTER_SENTRY_DSN" + constAuthEnvironment := "F8CLUSTER_ENVIRONMENT" + constAuthSentryDSN := "F8CLUSTER_SENTRY_DSN" constLocalEnv := "local" existingEnvironmentName := os.Getenv(constAuthEnvironment) @@ -95,14 +95,14 @@ func TestGetEnvironmentOK(t *testing.T) { } func TestAuthServiceURL(t *testing.T) { - existingEnvironment := os.Getenv("CLUSTER_DEVELOPER_MODE_ENABLED") + existingEnvironment := os.Getenv("F8CLUSTER_DEVELOPER_MODE_ENABLED") defer func() { - os.Setenv("CLUSTER_DEVELOPER_MODE_ENABLED", existingEnvironment) + os.Setenv("F8CLUSTER_DEVELOPER_MODE_ENABLED", existingEnvironment) resetConfiguration() }() - os.Unsetenv("CLUSTER_DEVELOPER_MODE_ENABLED") + os.Unsetenv("F8CLUSTER_DEVELOPER_MODE_ENABLED") - checkURLValidation(t, "CLUSTER_AUTH_URL", "Auth service") + checkURLValidation(t, "F8CLUSTER_AUTH_URL", "Auth service") } func checkURLValidation(t *testing.T, envName, serviceName string) { @@ -135,7 +135,7 @@ func checkURLValidation(t *testing.T, envName, serviceName string) { func TestGetSentryDSNOK(t *testing.T) { resource.Require(t, resource.UnitTest) - constSentryDSN := "CLUSTER_SENTRY_DSN" + constSentryDSN := "F8CLUSTER_SENTRY_DSN" existingDSN := os.Getenv(constSentryDSN) defer func() { os.Setenv(constSentryDSN, existingDSN) diff --git a/configuration/configuration_whitebox_test.go b/configuration/configuration_whitebox_test.go index c619bde..a24d3ee 100644 --- a/configuration/configuration_whitebox_test.go +++ b/configuration/configuration_whitebox_test.go @@ -40,7 +40,7 @@ func resetConfiguration() { func TestGetLogLevelOK(t *testing.T) { resource.Require(t, resource.UnitTest) - key := "CLUSTER_LOG_LEVEL" + key := "F8CLUSTER_LOG_LEVEL" realEnvValue := os.Getenv(key) os.Unsetenv(key) @@ -60,7 +60,7 @@ func TestGetLogLevelOK(t *testing.T) { func TestGetTransactionTimeoutOK(t *testing.T) { resource.Require(t, resource.UnitTest) - key := "CLUSTER_POSTGRES_TRANSACTION_TIMEOUT" + key := "F8CLUSTER_POSTGRES_TRANSACTION_TIMEOUT" realEnvValue := os.Getenv(key) os.Unsetenv(key) diff --git a/controller/status_test.go b/controller/status_test.go index d853ef0..b475288 100644 --- a/controller/status_test.go +++ b/controller/status_test.go @@ -67,13 +67,13 @@ func (rest *TestStatusREST) TestShowStatusWithoutDBFails() { } func (rest *TestStatusREST) TestShowStatusWithDefaultConfigInProdModeFails() { - existingDevMode := os.Getenv("CLUSTER_DEVELOPER_MODE_ENABLED") + existingDevMode := os.Getenv("F8CLUSTER_DEVELOPER_MODE_ENABLED") defer func() { - os.Setenv("CLUSTER_DEVELOPER_MODE_ENABLED", existingDevMode) + os.Setenv("F8CLUSTER_DEVELOPER_MODE_ENABLED", existingDevMode) rest.resetConfiguration() }() - os.Setenv("CLUSTER_DEVELOPER_MODE_ENABLED", "false") + os.Setenv("F8CLUSTER_DEVELOPER_MODE_ENABLED", "false") rest.resetConfiguration() svc, ctrl := rest.UnSecuredController() _, res := test.ShowStatusServiceUnavailable(rest.T(), svc.Context, svc, ctrl) diff --git a/docker-compose.yml b/docker-compose.yml index ba00715..9c0cc87 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: image: fabric8-services/fabric8-cluster:latest command: -config /usr/local/cluster/etc/config.yaml environment: - CLUSTER_POSTGRES_HOST: db + F8CLUSTER_POSTGRES_HOST: db ports: - "8087:8087" networks: diff --git a/gormtestsupport/db_test_suite.go b/gormtestsupport/db_test_suite.go index a6bd03a..842d82d 100644 --- a/gormtestsupport/db_test_suite.go +++ b/gormtestsupport/db_test_suite.go @@ -76,7 +76,7 @@ func (s *DBTestSuite) SetupTest() { // TearDownTest implements suite.TearDownTest func (s *DBTestSuite) TearDownTest() { // in some cases, we might need to keep the test data in the DB for inspecting/reproducing - // the SQL queries. In that case, the `CLUSTER_CLEAN_TEST_DATA` env variable should be set to `false`. + // the SQL queries. In that case, the `F8CLUSTER_CLEAN_TEST_DATA` env variable should be set to `false`. // By default, test data will be removed from the DB after each test if s.Configuration.IsCleanTestDataEnabled() { s.cleanTest() @@ -91,7 +91,7 @@ func (s *DBTestSuite) PopulateDBTestSuite(ctx context.Context) { // TearDownSuite implements suite.TearDownAllSuite func (s *DBTestSuite) TearDownSuite() { // in some cases, we might need to keep the test data in the DB for inspecting/reproducing - // the SQL queries. In that case, the `CLUSTER_CLEAN_TEST_DATA` env variable should be set to `false`. + // the SQL queries. In that case, the `F8CLUSTER_CLEAN_TEST_DATA` env variable should be set to `false`. // By default, test data will be removed from the DB after each test if s.Configuration.IsCleanTestDataEnabled() { s.cleanSuite() diff --git a/main.go b/main.go index a225ca9..8434a1f 100644 --- a/main.go +++ b/main.go @@ -47,8 +47,8 @@ func main() { // Override default -config switch with environment variable only if -config switch was // not explicitly given via the command line. - configFile = configFileFromFlags("config", "CLUSTER_CONFIG_FILE_PATH") - osoClusterConfigFile = configFileFromFlags("osoClusterConfigFile", "CLUSTER_OSO_CLUSTER_CONFIG_FILE") + configFile = configFileFromFlags("config", "F8CLUSTER_CONFIG_FILE_PATH") + osoClusterConfigFile = configFileFromFlags("osoClusterConfigFile", "F8CLUSTER_OSO_CLUSTER_CONFIG_FILE") config, err := configuration.NewConfigurationData(configFile, osoClusterConfigFile) if err != nil { diff --git a/openshift/auth.app.yaml b/openshift/f8cluster.app.yaml similarity index 74% rename from openshift/auth.app.yaml rename to openshift/f8cluster.app.yaml index 2e7dbc0..057c286 100644 --- a/openshift/auth.app.yaml +++ b/openshift/f8cluster.app.yaml @@ -1,18 +1,18 @@ kind: Template apiVersion: v1 metadata: - name: cluster + name: f8cluster objects: - kind: DeploymentConfig apiVersion: v1 metadata: labels: - service: cluster - name: cluster + service: f8cluster + name: f8cluster spec: replicas: ${{REPLICAS}} selector: - service: cluster + service: f8cluster strategy: rollingParams: intervalSeconds: 1 @@ -24,63 +24,63 @@ objects: template: metadata: labels: - service: cluster + service: f8cluster spec: containers: - image: ${IMAGE}:${IMAGE_TAG} env: - - name: CLUSTER_POSTGRES_HOST + - name: F8CLUSTER_POSTGRES_HOST valueFrom: secretKeyRef: - name: cluster + name: f8cluster key: db.host - - name: CLUSTER_POSTGRES_PORT + - name: F8CLUSTER_POSTGRES_PORT valueFrom: secretKeyRef: - name: cluster + name: f8cluster key: db.port - - name: CLUSTER_POSTGRES_USER + - name: F8CLUSTER_POSTGRES_USER valueFrom: secretKeyRef: - name: cluster + name: f8cluster key: db.user - - name: CLUSTER_POSTGRES_PASSWORD + - name: F8CLUSTER_POSTGRES_PASSWORD valueFrom: secretKeyRef: - name: cluster + name: f8cluster key: db.password - - name: CLUSTER_SENTRY_DSN + - name: F8CLUSTER_SENTRY_DSN valueFrom: secretKeyRef: - name: cluster + name: f8cluster key: sentry.dsn - - name: CLUSTER_POSTGRES_SSLMODE + - name: F8CLUSTER_POSTGRES_SSLMODE valueFrom: configMapKeyRef: - name: cluster + name: f8cluster key: postgres.sslmode - - name: CLUSTER_POSTGRES_CONNECTION_MAXIDLE + - name: F8CLUSTER_POSTGRES_CONNECTION_MAXIDLE valueFrom: configMapKeyRef: - name: cluster + name: f8cluster key: postgres.connection.maxidle - - name: CLUSTER_POSTGRES_CONNECTION_MAXOPEN + - name: F8CLUSTER_POSTGRES_CONNECTION_MAXOPEN valueFrom: configMapKeyRef: - name: cluster + name: f8cluster key: postgres.connection.maxopen - - name: CLUSTER_ENVIRONMENT + - name: F8CLUSTER_ENVIRONMENT valueFrom: configMapKeyRef: - name: cluster + name: f8cluster key: environment - - name: CLUSTER_AUTH_URL + - name: F8CLUSTER_AUTH_URL valueFrom: configMapKeyRef: - name: cluster + name: f8cluster key: auth.url imagePullPolicy: Always - name: cluster + name: f8cluster ports: - containerPort: 8087 protocol: TCP @@ -114,12 +114,12 @@ objects: terminationMessagePath: /dev/termination-log volumeMounts: - mountPath: /etc/fabric8/ - name: cluster-configs + name: f8cluster-configs readOnly: true volumes: - - name: cluster-configs + - name: f8cluster-configs secret: - secretName: cluster-config-files + secretName: f8cluster-config-files items: - key: oso.clusters path: oso-clusters.conf @@ -137,9 +137,9 @@ objects: - kind: Service apiVersion: v1 metadata: - name: cluster + name: f8cluster labels: - service: cluster + service: f8cluster spec: ports: - name: "8087" @@ -147,7 +147,7 @@ objects: port: 80 targetPort: 8087 selector: - service: cluster + service: f8cluster type: ClusterIP sessionAffinity: null parameters: diff --git a/openshift/auth.config.yaml b/openshift/f8cluster.config.yaml similarity index 96% rename from openshift/auth.config.yaml rename to openshift/f8cluster.config.yaml index 252d0ba..9b7379f 100644 --- a/openshift/auth.config.yaml +++ b/openshift/f8cluster.config.yaml @@ -1,12 +1,12 @@ kind: Template apiVersion: v1 metadata: - name: cluster + name: f8cluster objects: - apiVersion: v1 kind: Secret metadata: - name: cluster + name: f8cluster type: Opaque data: db.host: ZGI= @@ -17,7 +17,7 @@ objects: - apiVersion: v1 kind: Secret metadata: - name: cluster-config-files + name: f8cluster-config-files type: Opaque data: oso.clusters: >- @@ -25,7 +25,7 @@ objects: - apiVersion: v1 kind: ConfigMap metadata: - name: cluster + name: f8cluster type: Opaque data: postgres.sslmode: require diff --git a/resource/require.go b/resource/require.go index 3d971b0..570e88d 100644 --- a/resource/require.go +++ b/resource/require.go @@ -17,13 +17,13 @@ const ( // specify that unit tests shall be run. Unless this environment variable // is explicitly set to evaluate to false ("0", "no", or "false"), unit // tests are executed all the time. - UnitTest = "CLUSTER_RESOURCE_UNIT_TEST" + UnitTest = "F8CLUSTER_RESOURCE_UNIT_TEST" // Database refers to the name of the environment variable that is used to // specify that test can be run that require a database. - Database = "CLUSTER_RESOURCE_DATABASE" + Database = "F8CLUSTER_RESOURCE_DATABASE" // Remote refers to the name of the environment variable that is used to // specify that test can be run that require availability of some remote servers such as Keycloak. - Remote = "CLUSTER_RESOURCE_REMOTE" + Remote = "F8CLUSTER_RESOURCE_REMOTE" // StSkipReasonValueFalse is the skip message for tests when an environment variable is present but evaluates to false. StSkipReasonValueFalse = "Skipping test because environment variable %s evaluates to false: %s" // StSkipReasonNotSet is the skip message for tests when an environment is not present. @@ -42,7 +42,7 @@ func Require(t testing.TB, envVars ...string) { v, isSet := os.LookupEnv(envVar) // If we don't explicitly opt out from unit tests - // by specifying CLUSTER_RESOURCE_UNIT_TEST=0 + // by specifying F8CLUSTER_RESOURCE_UNIT_TEST=0 // we're going to run them if !isSet && envVar == UnitTest { continue diff --git a/token/token_whitebox_test.go b/token/token_whitebox_test.go index 1f50428..fca72b1 100644 --- a/token/token_whitebox_test.go +++ b/token/token_whitebox_test.go @@ -22,11 +22,11 @@ type WhiteBoxTestTokenSuite struct { func (s *WhiteBoxTestTokenSuite) TestNoTestKeyLoadedIfRunInNotDevMode() { // Disable Dev Mode - existingEnvironment := os.Getenv("CLUSTER_DEVELOPER_MODE_ENABLED") + existingEnvironment := os.Getenv("F8CLUSTER_DEVELOPER_MODE_ENABLED") defer func() { - os.Setenv("CLUSTER_DEVELOPER_MODE_ENABLED", existingEnvironment) + os.Setenv("F8CLUSTER_DEVELOPER_MODE_ENABLED", existingEnvironment) }() - os.Unsetenv("CLUSTER_DEVELOPER_MODE_ENABLED") + os.Unsetenv("F8CLUSTER_DEVELOPER_MODE_ENABLED") c, err := config.GetConfigurationData() require.NoError(s.T(), err)