Merge pull request #5556 from influxdata/fix-test-product-environments
Fix test product environmentspull/5557/head
commit
07f1f5e92f
30
compose.yaml
30
compose.yaml
|
@ -38,8 +38,6 @@ services:
|
||||||
cloud-pytest:
|
cloud-pytest:
|
||||||
image: influxdata/docs-pytest
|
image: influxdata/docs-pytest
|
||||||
build:
|
build:
|
||||||
args:
|
|
||||||
- CONTENT_PATH=content/influxdb/cloud
|
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.pytest
|
dockerfile: Dockerfile.pytest
|
||||||
entrypoint:
|
entrypoint:
|
||||||
|
@ -50,6 +48,8 @@ services:
|
||||||
# In the command, pass file paths to test.
|
# In the command, pass file paths to test.
|
||||||
# The container preprocesses the files for testing and runs the tests.
|
# The container preprocesses the files for testing and runs the tests.
|
||||||
- content/influxdb/cloud/**/*.md
|
- content/influxdb/cloud/**/*.md
|
||||||
|
environment:
|
||||||
|
- CONTENT_PATH=content/influxdb/cloud
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
- v2
|
- v2
|
||||||
|
@ -87,8 +87,6 @@ services:
|
||||||
cloud-dedicated-pytest:
|
cloud-dedicated-pytest:
|
||||||
image: influxdata/docs-pytest
|
image: influxdata/docs-pytest
|
||||||
build:
|
build:
|
||||||
args:
|
|
||||||
- CONTENT_PATH=content/influxdb/cloud-dedicated
|
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.pytest
|
dockerfile: Dockerfile.pytest
|
||||||
entrypoint:
|
entrypoint:
|
||||||
|
@ -99,6 +97,8 @@ services:
|
||||||
# In the command, pass file paths to test.
|
# In the command, pass file paths to test.
|
||||||
# The container preprocesses the files for testing and runs the tests.
|
# The container preprocesses the files for testing and runs the tests.
|
||||||
- content/influxdb/cloud-dedicated/**/*.md
|
- content/influxdb/cloud-dedicated/**/*.md
|
||||||
|
environment:
|
||||||
|
- CONTENT_PATH=content/influxdb/cloud-dedicated
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
- v3
|
- v3
|
||||||
|
@ -141,8 +141,6 @@ services:
|
||||||
cloud-serverless-pytest:
|
cloud-serverless-pytest:
|
||||||
image: influxdata/docs-pytest
|
image: influxdata/docs-pytest
|
||||||
build:
|
build:
|
||||||
args:
|
|
||||||
- CONTENT_PATH=content/influxdb/cloud-serverless
|
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.pytest
|
dockerfile: Dockerfile.pytest
|
||||||
entrypoint:
|
entrypoint:
|
||||||
|
@ -153,6 +151,8 @@ services:
|
||||||
# In the command, pass file paths to test.
|
# In the command, pass file paths to test.
|
||||||
# The container preprocesses the files for testing and runs the tests.
|
# The container preprocesses the files for testing and runs the tests.
|
||||||
- content/influxdb/cloud-serverless/**/*.md
|
- content/influxdb/cloud-serverless/**/*.md
|
||||||
|
environment:
|
||||||
|
- CONTENT_PATH=content/influxdb/cloud-serverless
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
- v3
|
- v3
|
||||||
|
@ -190,8 +190,6 @@ services:
|
||||||
clustered-pytest:
|
clustered-pytest:
|
||||||
image: influxdata/docs-pytest
|
image: influxdata/docs-pytest
|
||||||
build:
|
build:
|
||||||
args:
|
|
||||||
- CONTENT_PATH=content/influxdb/clustered
|
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.pytest
|
dockerfile: Dockerfile.pytest
|
||||||
entrypoint:
|
entrypoint:
|
||||||
|
@ -202,6 +200,8 @@ services:
|
||||||
# In the command, pass file paths to test.
|
# In the command, pass file paths to test.
|
||||||
# The container preprocesses the files for testing and runs the tests.
|
# The container preprocesses the files for testing and runs the tests.
|
||||||
- content/influxdb/clustered/**/*.md
|
- content/influxdb/clustered/**/*.md
|
||||||
|
environment:
|
||||||
|
- CONTENT_PATH=content/influxdb/clustered
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
- v3
|
- v3
|
||||||
|
@ -244,8 +244,6 @@ services:
|
||||||
telegraf-pytest:
|
telegraf-pytest:
|
||||||
image: influxdata/docs-pytest
|
image: influxdata/docs-pytest
|
||||||
build:
|
build:
|
||||||
args:
|
|
||||||
- CONTENT_PATH=content/telegraf
|
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.pytest
|
dockerfile: Dockerfile.pytest
|
||||||
entrypoint:
|
entrypoint:
|
||||||
|
@ -256,6 +254,8 @@ services:
|
||||||
# In the command, pass file paths to test.
|
# In the command, pass file paths to test.
|
||||||
# The container preprocesses the files for testing and runs the tests.
|
# The container preprocesses the files for testing and runs the tests.
|
||||||
- content/telegraf/**/*.md
|
- content/telegraf/**/*.md
|
||||||
|
environment:
|
||||||
|
- CONTENT_PATH=content/telegraf
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
@ -292,8 +292,6 @@ services:
|
||||||
v2-pytest:
|
v2-pytest:
|
||||||
image: influxdata/docs-pytest
|
image: influxdata/docs-pytest
|
||||||
build:
|
build:
|
||||||
args:
|
|
||||||
- CONTENT_PATH=content/influxdb/v2
|
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.pytest
|
dockerfile: Dockerfile.pytest
|
||||||
entrypoint:
|
entrypoint:
|
||||||
|
@ -304,6 +302,8 @@ services:
|
||||||
# In the command, pass file paths to test.
|
# In the command, pass file paths to test.
|
||||||
# The container preprocesses the files for testing and runs the tests.
|
# The container preprocesses the files for testing and runs the tests.
|
||||||
- content/influxdb/v2/**/*.md
|
- content/influxdb/v2/**/*.md
|
||||||
|
environment:
|
||||||
|
- CONTENT_PATH=content/influxdb/v2
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
- v2
|
- v2
|
||||||
|
@ -348,7 +348,9 @@ services:
|
||||||
DOCKER_INFLUXDB_INIT_PASSWORD_FILE: /run/secrets/influxdb2-admin-password
|
DOCKER_INFLUXDB_INIT_PASSWORD_FILE: /run/secrets/influxdb2-admin-password
|
||||||
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN_FILE: /run/secrets/influxdb2-admin-token
|
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN_FILE: /run/secrets/influxdb2-admin-token
|
||||||
DOCKER_INFLUXDB_INIT_ORG: docs
|
DOCKER_INFLUXDB_INIT_ORG: docs
|
||||||
DOCKER_INFLUXDB_INIT_BUCKET: home
|
DOCKER_INFLUXDB_INIT_BUCKET: get-started
|
||||||
|
INFLUX_ORG: docs
|
||||||
|
INFLUX_BUCKET: get-started
|
||||||
profiles:
|
profiles:
|
||||||
- v2
|
- v2
|
||||||
- local
|
- local
|
||||||
|
@ -367,7 +369,7 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: .ci/Dockerfile.remark
|
dockerfile: .ci/Dockerfile.remark
|
||||||
command: ["remark", "content/${PRODUCT_PATH}"]
|
command: ["remark", "${CONTENT_PATH}"]
|
||||||
profiles:
|
profiles:
|
||||||
- lint
|
- lint
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -84,8 +84,12 @@ function substitute_placeholders {
|
||||||
s/example-db/$INFLUX_DATABASE/g;
|
s/example-db/$INFLUX_DATABASE/g;
|
||||||
s/get-started/$INFLUX_DATABASE/g;
|
s/get-started/$INFLUX_DATABASE/g;
|
||||||
/os.getenv("MANAGEMENT_TOKEN")/! s/INFLUX_MANAGEMENT_TOKEN/$MANAGEMENT_TOKEN/g;
|
/os.getenv("MANAGEMENT_TOKEN")/! s/INFLUX_MANAGEMENT_TOKEN/$MANAGEMENT_TOKEN/g;
|
||||||
|
/os.getenv("ORG_NAME")/! s/ORG_NAME/$INFLUX_ORG_NAME/g;
|
||||||
|
/os.getenv("ORG_ID")/! s/ORG_ID/$INFLUX_ORG/g;
|
||||||
|
/os.getenv("PASSWORD")/! s/PASSWORD/$INFLUX_PASSWORD/g;
|
||||||
/os.getenv("ORG_ID")/! s/ORG_ID/$INFLUX_ORG/g;
|
/os.getenv("ORG_ID")/! s/ORG_ID/$INFLUX_ORG/g;
|
||||||
/os.getenv("RETENTION_POLICY")/! s/RETENTION_POLICY_NAME\|RETENTION_POLICY/$INFLUX_RETENTION_POLICY/g;
|
/os.getenv("RETENTION_POLICY")/! s/RETENTION_POLICY_NAME\|RETENTION_POLICY/$INFLUX_RETENTION_POLICY/g;
|
||||||
|
/os.getenv("USERNAME")/! s/USERNAME/$INFLUX_USERNAME/g;
|
||||||
s/CONFIG_NAME/CONFIG_$(shuf -i 0-100 -n1)/g;
|
s/CONFIG_NAME/CONFIG_$(shuf -i 0-100 -n1)/g;
|
||||||
s/TEST_RUN/TEST_RUN_$(date +%s)/g;
|
s/TEST_RUN/TEST_RUN_$(date +%s)/g;
|
||||||
s|/path/to/custom/assets-dir|/app/custom-assets|g;' \
|
s|/path/to/custom/assets-dir|/app/custom-assets|g;' \
|
||||||
|
@ -109,16 +113,6 @@ function substitute_placeholders {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
setup() {
|
|
||||||
# Set up the environment for the tests.
|
|
||||||
# Parse YAML config files into dotenv files to be used by tests.
|
|
||||||
mkdir -p /app/appdata && (parse_yaml /src/data/products.yml > /app/appdata/.env.products)
|
|
||||||
|
|
||||||
# Miscellaneous test setup.
|
|
||||||
# For macOS samples.
|
|
||||||
mkdir -p ~/Downloads && rm -rf ~/Downloads/*
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_tests() {
|
prepare_tests() {
|
||||||
echo "Preparing test files: $*"
|
echo "Preparing test files: $*"
|
||||||
SRC_FILES="$*"
|
SRC_FILES="$*"
|
||||||
|
@ -130,7 +124,6 @@ prepare_tests() {
|
||||||
done
|
done
|
||||||
cd /app
|
cd /app
|
||||||
substitute_placeholders
|
substitute_placeholders
|
||||||
setup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_tests "$*"
|
prepare_tests "$*"
|
||||||
|
|
|
@ -23,6 +23,32 @@ tests="${*:2}"
|
||||||
rm -rf /app/"${CONTENT_PATH}"/*
|
rm -rf /app/"${CONTENT_PATH}"/*
|
||||||
bash /src/test/scripts/prepare-content.sh $tests
|
bash /src/test/scripts/prepare-content.sh $tests
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
# Set up the environment for the tests.
|
||||||
|
|
||||||
|
## Store test configuration in /app/appdata.
|
||||||
|
mkdir -p /app/appdata
|
||||||
|
|
||||||
|
## Parse YAML config files into dotenv files to be used by tests.
|
||||||
|
## You must source the parse_yaml function before you can use it.
|
||||||
|
source /usr/local/bin/parse_yaml
|
||||||
|
parse_yaml /src/data/products.yml > /app/appdata/.env.products
|
||||||
|
chmod -R +x /app/appdata/
|
||||||
|
|
||||||
|
## Source non-sensitive environment variables for all test runners.
|
||||||
|
set -a
|
||||||
|
source /app/appdata/.env.*
|
||||||
|
set +a
|
||||||
|
|
||||||
|
# Miscellaneous test setup.
|
||||||
|
# For macOS samples.
|
||||||
|
mkdir -p ~/Downloads && rm -rf ~/Downloads/*
|
||||||
|
}
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
if [[ $runner == "pytest" ]]; then
|
if [[ $runner == "pytest" ]]; then
|
||||||
pytest \
|
pytest \
|
||||||
-s \
|
-s \
|
||||||
|
|
Loading…
Reference in New Issue