fix(ci): test content:
- Add python replacement for get-started database/bucket name - Fixes race condition when deleting previous content: - Assign each product it's own test content volume instead of sharing a volume. - Delete existing content in the volume before copying test files. - Pros and cons, but I suspect a similar approach will be better when ported to Circle CI.pull/5505/head
parent
922e48182a
commit
ea9b786b83
|
@ -6,14 +6,26 @@ function testStagedContent(paths, productPath) {
|
||||||
const TEST = `pytest-${productName}`;
|
const TEST = `pytest-${productName}`;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Remove any existing test container and volume
|
// Remove existing containers
|
||||||
`sh -c "docker rm -f ${CONTENT} || true"`,
|
`sh -c "docker rm -f ${CONTENT} || true"`,
|
||||||
`sh -c "docker rm -f ${TEST} || true"`,
|
`sh -c "docker rm -f ${TEST} || true"`,
|
||||||
|
|
||||||
`docker build . -f Dockerfile.tests -t influxdata-docs/tests:latest`,
|
`docker build . -f Dockerfile.tests -t influxdata-docs/tests:latest`,
|
||||||
|
|
||||||
|
// Remove any existing Docker volume for staged content
|
||||||
|
`sh -c "docker volume rm -f ${CONTENT} || true"`,
|
||||||
|
|
||||||
|
// Create a Docker volume for product staged content
|
||||||
|
`sh -c "docker volume create \
|
||||||
|
--label tag=influxdata-docs \
|
||||||
|
--label stage=test \
|
||||||
|
--name ${CONTENT} || true"`,
|
||||||
|
|
||||||
// Copy staged content to a volume and run the prepare script
|
// Copy staged content to a volume and run the prepare script
|
||||||
|
// to remove the existing
|
||||||
`docker run --name ${CONTENT}
|
`docker run --name ${CONTENT}
|
||||||
|
--label tag=influxdata-docs
|
||||||
|
--label stage=test
|
||||||
--mount type=volume,source=staged-content,target=/app/content
|
--mount type=volume,source=staged-content,target=/app/content
|
||||||
--mount type=bind,src=./content,dst=/src/content
|
--mount type=bind,src=./content,dst=/src/content
|
||||||
--mount type=bind,src=./static/downloads,dst=/app/data
|
--mount type=bind,src=./static/downloads,dst=/app/data
|
||||||
|
@ -38,7 +50,10 @@ function testStagedContent(paths, productPath) {
|
||||||
echo 'No tests to run.'; \
|
echo 'No tests to run.'; \
|
||||||
exit 0; \
|
exit 0; \
|
||||||
else \
|
else \
|
||||||
docker run --rm --name ${TEST} \
|
docker run --rm \
|
||||||
|
--label tag=influxdata-docs \
|
||||||
|
--label stage=test \
|
||||||
|
--name ${TEST} \
|
||||||
--env-file ${productPath}/.env.test \
|
--env-file ${productPath}/.env.test \
|
||||||
--volumes-from ${CONTENT} \
|
--volumes-from ${CONTENT} \
|
||||||
influxdata-docs/pytest --codeblocks --exitfirst ${productPath}/;
|
influxdata-docs/pytest --codeblocks --exitfirst ${productPath}/;
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ _This tutorial assumes using Maven version 3.9, Java version >= 15, and an `infl
|
||||||
|
|
||||||
- The `App`, `Write`, and `Query` classes belong to the `com.influxdbv3` package (your project **groupId**).
|
- The `App`, `Write`, and `Query` classes belong to the `com.influxdbv3` package (your project **groupId**).
|
||||||
- `App` defines a `main()` function that calls `Write.writeLineProtocol()` and `Query.querySQL()`.
|
- `App` defines a `main()` function that calls `Write.writeLineProtocol()` and `Query.querySQL()`.
|
||||||
4. In your terminal or editor, use Maven to to install dependencies and compile the project code--for example:
|
4. In your terminal or editor, use Maven to install dependencies and compile the project code--for example:
|
||||||
|
|
||||||
<!--pytest.mark.skip-->
|
<!--pytest.mark.skip-->
|
||||||
|
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ _This tutorial assumes using Maven version 3.9, Java version >= 15, and an `infl
|
||||||
|
|
||||||
- The `App`, `Write`, and `Query` classes belong to the `com.influxdbv3` package (your project **groupId**).
|
- The `App`, `Write`, and `Query` classes belong to the `com.influxdbv3` package (your project **groupId**).
|
||||||
- `App` defines a `main()` function that calls `Write.writeLineProtocol()` and `Query.querySQL()`.
|
- `App` defines a `main()` function that calls `Write.writeLineProtocol()` and `Query.querySQL()`.
|
||||||
4. In your terminal or editor, use Maven to to install dependencies and compile the project code--for example:
|
4. In your terminal or editor, use Maven to install dependencies and compile the project code--for example:
|
||||||
|
|
||||||
<!--pytest.mark.skip-->
|
<!--pytest.mark.skip-->
|
||||||
|
|
||||||
|
|
|
@ -1010,7 +1010,7 @@ _This tutorial assumes using Maven version 3.9, Java version >= 15, and an `infl
|
||||||
|
|
||||||
- The `App`, `Write`, and `Query` classes belong to the `com.influxdbv3` package (your project **groupId**).
|
- The `App`, `Write`, and `Query` classes belong to the `com.influxdbv3` package (your project **groupId**).
|
||||||
- `App` defines a `main()` function that calls `Write.writeLineProtocol()` and `Query.querySQL()`.
|
- `App` defines a `main()` function that calls `Write.writeLineProtocol()` and `Query.querySQL()`.
|
||||||
4. In your terminal or editor, use Maven to to install dependencies and compile the project code--for example:
|
4. In your terminal or editor, use Maven to install dependencies and compile the project code--for example:
|
||||||
|
|
||||||
<!--pytest.mark.skip-->
|
<!--pytest.mark.skip-->
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ function substitute_placeholders {
|
||||||
s/f"API_TOKEN"/os.getenv("INFLUX_TOKEN")/g;
|
s/f"API_TOKEN"/os.getenv("INFLUX_TOKEN")/g;
|
||||||
s/f"BUCKET_NAME"/os.getenv("INFLUX_DATABASE")/g;
|
s/f"BUCKET_NAME"/os.getenv("INFLUX_DATABASE")/g;
|
||||||
s/f"DATABASE_NAME"/os.getenv("INFLUX_DATABASE")/g;
|
s/f"DATABASE_NAME"/os.getenv("INFLUX_DATABASE")/g;
|
||||||
|
s/f"get-started"/os.getenv("INFLUX_DATABASE")/g;
|
||||||
s|f"{{< influxdb/host >}}"|os.getenv("INFLUX_HOSTNAME")|g;
|
s|f"{{< influxdb/host >}}"|os.getenv("INFLUX_HOSTNAME")|g;
|
||||||
s|f"RETENTION_POLICY_NAME\|RETENTION_POLICY"|"autogen"|g;
|
s|f"RETENTION_POLICY_NAME\|RETENTION_POLICY"|"autogen"|g;
|
||||||
' $file
|
' $file
|
||||||
|
@ -76,8 +77,6 @@ setup() {
|
||||||
prepare_tests() {
|
prepare_tests() {
|
||||||
TEST_FILES="$*"
|
TEST_FILES="$*"
|
||||||
|
|
||||||
# Remove files from the previous run.
|
|
||||||
rm -rf "$TEST_CONTENT"/*
|
|
||||||
# Copy the test files to the target directory while preserving the directory structure.
|
# Copy the test files to the target directory while preserving the directory structure.
|
||||||
for FILE in $TEST_FILES; do
|
for FILE in $TEST_FILES; do
|
||||||
# Create the parent directories of the destination file
|
# Create the parent directories of the destination file
|
||||||
|
|
Loading…
Reference in New Issue