diff --git a/Dockerfile b/Dockerfile
index e9729b0bc..f4d6e5550 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,47 +1,47 @@
-# syntax=docker/dockerfile:1
-
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/
-ARG PYTHON_VERSION=3.11.5
-
-FROM python:${PYTHON_VERSION}-slim as base
+FROM python:3.12.0-slim-bookworm
RUN apt-get update && apt-get install -y \
curl \
git \
+ gpg \
+ wget \
&& rm -rf /var/lib/apt/lists/*
+WORKDIR /usr/src/app
+
ARG SOURCE_DIR
-ARG TESTS_DIR
+
+COPY test ./test
+COPY data ./test/data
+
+RUN chmod -R 755 .
# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
-
-# Keeps Python from buffering stdout and stderr to avoid situations where
+ @@ -22,26 +28,23 @@ ENV PYTHONDONTWRITEBYTECODE=1
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1
-COPY $SOURCE_DIR /app/$SOURCE_DIR
+WORKDIR /usr/src/app/${SOURCE_DIR}
-WORKDIR /app/$SOURCE_DIR
-RUN chmod -R 755 /app/$SOURCE_DIR
-
-COPY $SOURCE_DIR/run-tests.sh /usr/local/bin/run-tests.sh
+COPY test/run-tests.sh /usr/local/bin/run-tests.sh
RUN chmod +x /usr/local/bin/run-tests.sh
# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
-# into this layer.
+# this layer.
RUN --mount=type=cache,target=/root/.cache/pip \
- --mount=type=bind,source=${SOURCE_DIR}/requirements.txt,target=requirements.txt \
- python -m pip install -r requirements.txt
+ --mount=type=bind,source=test/requirements.txt,target=./requirements.txt \
+ python -m pip install -r ./requirements.txt
# RUN --mount=type=cache,target=/root/.cache/node_modules \
# --mount=type=bind,source=package.json,target=package.json \
# npm install
-WORKDIR $TESTS_DIR
-ENTRYPOINT ["run-tests.sh"]
-CMD [""]
+ENV TEMP_DIR=./tmp
+ENTRYPOINT [ "run-tests.sh" ]
+CMD [""]
\ No newline at end of file
diff --git a/compose.yaml b/compose.yaml
index 97f9f47ec..b47b287a6 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -3,15 +3,19 @@
services:
test:
image: docs-v2-tests
+ container_name: docs-v2-tests
env_file:
+ - ./test/.env.influxdbv2
- ./test/.env.influxdbv3
volumes:
- type: bind
- source: ./test/tmp
- target: /app/test/tmp
+ source: ./test
+ target: /usr/src/app/test
+ - type: bind
+ source: ./data
+ target: /usr/src/app/test/data
build:
context: .
dockerfile: Dockerfile
args:
- - SOURCE_DIR=test
- - TESTS_DIR=tmp
+ - SOURCE_DIR=test
\ No newline at end of file
diff --git a/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md b/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md
index d1d251d04..2eef1db49 100644
--- a/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md
+++ b/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md
@@ -11,6 +11,20 @@ menu:
weight: 202
---
+## v2.3.0 {date="2023-11-06"}
+
+_Features updated in this release are meant for internal InfluxData use and do
+not affect any public APIs._
+
+### Dependency updates
+
+- Update `github.com/go-git/go-git/v5` from 5.9.0 to 5.10.0.
+- Update `github.com/google/uuid` from 1.3.1 to 1.4.0.
+- Update `github.com/jedib0t/go-pretty/v6` from 6.4.8 to 6.4.9.
+- Update `golang.org/x/mod` from 0.13.0 to 0.14.0.
+
+---
+
## v2.2.0 {date="2023-10-27"}
### Features
diff --git a/content/influxdb/clustered/reference/release-notes/influxctl.md b/content/influxdb/clustered/reference/release-notes/influxctl.md
index 4cc4ed539..0f09f8f8a 100644
--- a/content/influxdb/clustered/reference/release-notes/influxctl.md
+++ b/content/influxdb/clustered/reference/release-notes/influxctl.md
@@ -12,6 +12,20 @@ weight: 202
canonical: /influxdb/cloud-dedicated/reference/release-notes/influxctl/
---
+## v2.3.0 {date="2023-11-06"}
+
+_Features updated in this release are meant for internal InfluxData use and do
+not affect any public APIs._
+
+### Dependency updates
+
+- Update `github.com/go-git/go-git/v5` from 5.9.0 to 5.10.0.
+- Update `github.com/google/uuid` from 1.3.1 to 1.4.0.
+- Update `github.com/jedib0t/go-pretty/v6` from 6.4.8 to 6.4.9.
+- Update `golang.org/x/mod` from 0.13.0 to 0.14.0.
+
+---
+
## v2.2.0 {date="2023-10-27"}
### Features
diff --git a/content/influxdb/v2/install/_index.md b/content/influxdb/v2/install/_index.md
index 61a427394..f46f3dd05 100644
--- a/content/influxdb/v2/install/_index.md
+++ b/content/influxdb/v2/install/_index.md
@@ -1024,4 +1024,4 @@ Because [Operator tokens](/influxdb/v2/admin/tokens/#operator-token)
have full read and write access to all organizations in the database,
we recommend
[creating an All-Access token](/influxdb/v2/admin/tokens/create-token/)
-for each organization and using those tokens to manage InfluxDB.
+for each organization and using those tokens to manage InfluxDB.
\ No newline at end of file
diff --git a/content/influxdb/v2/tools/influx-cli.md b/content/influxdb/v2/tools/influx-cli.md
index d14f8becb..ef50b10c4 100644
--- a/content/influxdb/v2/tools/influx-cli.md
+++ b/content/influxdb/v2/tools/influx-cli.md
@@ -51,6 +51,9 @@ Do one of the following:
- [Manually download and install](#manually-download-and-install)
### Use Homebrew
+
+
+
```sh
brew install influxdb-cli
```
@@ -62,6 +65,8 @@ If you used Homebrew to install **InfluxDB {{< current-version >}}**, the `influ
formula was downloaded as a dependency and should already be installed.
If installed, `influxdb-cli` will appear in the output of the following command:
+
+
```sh
brew list | grep influxdb-cli
```
@@ -71,39 +76,67 @@ brew list | grep influxdb-cli
### Manually download and install
-1. **Download the `influx` CLI package.**
+1. Download the `influx` CLI package [from your browser](#download-from-your-browser)
+ or [from the command line](#download-from-the-command-line).
+
+ #### Download from your browser
influx CLI v{{< latest-patch cli=true >}} (macOS)
-2. **Unpackage the downloaded package.**
+ #### Download from the command line
+
+ ```sh
+ curl -O https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz \
+ --output-dir ~/Downloads
+ ```
+
+2. Unpackage the downloaded binary.
Do one of the following:
- - Double-click the downloaded package file in **Finder**.
- - Run the following command in a macOS command prompt application such
- **Terminal** or **[iTerm2](https://www.iterm2.com/)**:
+ - In **Finder**, double-click the downloaded package file.
+ - In your terminal (for example, **Terminal** or **[iTerm2](https://www.iterm2.com/)**) use `tar` to extract the package--for example, enter the following command to extract it into `~/Downloads`:
```sh
- # Unpackage contents to the current working directory
- tar zxvf ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz
+ tar zxvf ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz \
+ --directory ~/Downloads
```
-3. **(Optional) Place the binary in your `$PATH`.**
+3. Optional: Place the `influx` binary in your `$PATH`--for example, copy the binary to `/usr/local/bin`:
```sh
- # (Optional) Copy the influx binary to your $PATH
- sudo cp ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64/influx /usr/local/bin/
+ sudo cp ~/Downloads/influx /usr/local/bin/
```
- If you do not move the `influx` binary into your `$PATH`, prefix the executable
- `./` to run it in place.
+ With the `influx` binary in your `$PATH` (`/usr/local/bin`), you can enter `influx` in your terminal to run the CLI.
-4. **(macOS Catalina and newer) Authorize the `influx` binary.**
+ If you do not move the `influx` binary into your `$PATH`, enter the path to the binary to run the CLI--for example:
+
+
+
+ ```sh
+ ~/Downloads/influx
+ ```
+
+4. (macOS Catalina and newer) Authorize the `influx` binary.
macOS requires downloaded binaries to be signed by registered Apple developers.
- When you first attempt to run `influx`, macOS will prevent it from running.
+ When you first attempt to run `influx`, macOS prevents it from running.
To authorize the `influx` binary:
+ **Allow the binary on macOS Ventura**
+
+ 1. Follow the preceding instructions to attempt to start `influx`.
+ 2. Open **System Settings** and click **Privacy & Security**.
+ 3. Under the **Security** heading, there is a message about "influxd" being blocked, click **Allow Anyway**.
+ 5. When prompted, enter your password to allow the setting.
+ 6. Close **System Settings**.
+ 7. Attempt to start `influx`.
+ 8. A prompt appears with the message _"macOS cannot verify the developer of "influx"...""_.
+ Click **Open**.
+
+ **Allow the binary on macOS Catalina**
+
1. Attempt to run an `influx` command.
2. Open **System Preferences** and click **Security & Privacy**.
3. Under the **General** tab, there is a message about `influx` being blocked.
@@ -115,9 +148,7 @@ brew list | grep influxdb-cli
{{% tab-content %}}
-1. **Download the influx CLI package.**
-
- Download the `influx` CLI package [from your browser](#download-from-your-browser)
+1. Download the `influx` CLI package [from your browser](#download-from-your-browser)
or [from the command line](#download-from-the-command-line).
#### Download from your browser
@@ -127,38 +158,49 @@ brew list | grep influxdb-cli
#### Download from the command line
- ```sh
- # amd64
- wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
+ ```sh
+ # amd64
+ wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
+ ```
- # arm
- wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
- ```
+ ```sh
+ # arm
+ wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
+ ```
-4. **Unpackage the downloaded package.**
+2. Unpackage the downloaded binary.
_**Note:** The following commands are examples. Adjust the filenames, paths, and utilities if necessary._
```sh
# amd64
- tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
-
- # arm
- tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
+ tar xvzf ./influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
```
-3. **(Optional) Place the unpackaged `influx` executable in your system `$PATH`.**
+ ```sh
+ # arm
+ tar xvzf ./influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
+ ```
+
+3. Optional: Place the unpackaged `influx` executable in your system `$PATH`.
```sh
# amd64
- sudo cp influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64/influx /usr/local/bin/
-
- # arm
- sudo cp influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64/influx /usr/local/bin/
+ sudo cp ./influx /usr/local/bin/
```
- If you do not move the `influx` binary into your `$PATH`, prefix the executable
- `./` to run it in place.
+ ```sh
+ # arm
+ sudo cp ./influx /usr/local/bin/
+ ```
+
+ If you do not move the `influxd` binary into your `$PATH`, enter the path to the binary to start the server--for example:
+
+
+
+ ```sh
+ ./influx
+ ```
{{% /tab-content %}}
@@ -171,20 +213,22 @@ We recommend running `influx` CLI commands in Powershell.
Command Prompt is not fully compatible.
{{% /note %}}
-1. **Download the `influx` CLI package.**
+1. Download the `influx` CLI package.
influx CLI v{{< latest-patch cli=true >}} (Windows)
-2. **Expand the downloaded archive.**
+2. Expand the downloaded archive.
Expand the downloaded archive into `C:\Program Files\InfluxData\` and rename it if desired.
+
+
```powershell
> Expand-Archive .\influxdb2-client-{{< latest-patch cli=true >}}-windows-amd64.zip -DestinationPath 'C:\Program Files\InfluxData\'
> mv 'C:\Program Files\InfluxData\influxdb2-client-{{< latest-patch cli=true >}}-windows-amd64' 'C:\Program Files\InfluxData\influx'
```
-3. **Grant network access to the `influx` CLI.**
+3. Grant network access to the `influx` CLI.
When using the `influx` CLI for the first time, **Windows Defender** displays
the following message:
@@ -214,13 +258,22 @@ credentials from the active config.
Use the [`influx config create` command](/influxdb/v2/reference/cli/influx/config/create/)
to create an `influx` CLI config and set it as active:
+
+{{% code-placeholders "API_TOKEN|ORG|http://localhost:8086|CONFIG_NAME" %}}
```sh
-influx config create --config-name \
+influx config create --config-name CONFIG_NAME \
--host-url http://localhost:8086 \
- --org \
- --token \
+ --org ORG \
+ --token API_TOKEN \
--active
```
+{{% /code-placeholders %}}
+
+Replace the following:
+
+- {{% code-placeholder-key %}}`CONFIG_NAME`{{% /code-placeholder-key %}}: Connection configuration name.
+- {{% code-placeholder-key %}}`ORG_NAME`{{% /code-placeholder-key %}}: your InfluxDB [organization](/influxdb/v2/admin/organizations/).
+- {{% code-placeholder-key %}}`API_TOKEN`{{% /code-placeholder-key %}}: your [API token](/influxdb/v2/admin/tokens/).
For more information about managing CLI configurations, see the
[`influx config` documentation](/influxdb/v2/reference/cli/influx/config/).
@@ -239,16 +292,24 @@ The CLI retrieves a session cookie and stores it, unencrypted, in your
Use the `--username-password`, `-p` option to provide your username and password
using the `:` syntax.
-If no password is provided, the CLI will prompt for a password after each
+If no password is provided, the CLI prompts for a password after each
command that requires authentication.
+{{% code-placeholders "API_TOKEN|ORG|http://localhost:8086|CONFIG_NAME|USERNAME|PASSWORD" %}}
```sh
influx config create \
- -n config-name \
+ -n CONFIG_NAME \
-u http://localhost:8086 \
- -p example-user:example-password \
- -o example-org
+ -p USERNAME:PASSWORD \
+ -o ORG
```
+{{% /code-placeholders %}}
+
+Replace the following:
+
+- {{% code-placeholder-key %}}`CONFIG_NAME`{{% /code-placeholder-key %}}: Connection configuration name.
+- {{% code-placeholder-key %}}`ORG`{{% /code-placeholder-key %}}: [your organization name](/influxdb/v2/admin/organizations/).
+- {{% code-placeholder-key %}}`USERNAME:PASSWORD`{{% /code-placeholder-key %}}: your UI username and password combination.
{{% /oss-only %}}
@@ -259,4 +320,4 @@ To install `influx` shell completion scripts, see
## Use influx CLI commands
_For information about `influx` CLI commands, see the
-[`influx` CLI reference documentation](/influxdb/v2/reference/cli/influx/)._
+[`influx` CLI reference documentation](/influxdb/v2/reference/cli/influx/)._
\ No newline at end of file
diff --git a/test.sh b/test.sh
index d1818655d..a828e59e9 100755
--- a/test.sh
+++ b/test.sh
@@ -30,7 +30,7 @@ rm -rf "$target"/*
# Check if the user provided a path to copy.
if [ -z "$paths" ]; then
echo "No path provided. Running tests for *.md files that have been added or modified in the current branch."
- paths=$(git diff --name-only --diff-filter=AM --relative master | \
+ paths=$(git diff --name-only --diff-filter=AM --relative origin/master | \
grep -E '\.md$')
else
paths=$(find "$paths" -type f -name '*.md')
@@ -39,5 +39,14 @@ fi
# Log the list of files to be tested and copy them to the test directory.
echo "$paths" >> "$testrun"
echo "$paths" | rsync -arv --files-from=- . "$target"
-# Start a new container and run the tests.
-docker compose run --no-TTY test
+
+# Build the test image, run the tests, and then remove the container after it exits.
+docker compose run --build --rm test
+
+# To help debug test failures, run the container and pass additional flags to be used by the container's entrypoint and the test runners it executes--for example:
+# docker compose run --rm test -v
+# docker compose run --rm test --entrypoint /bin/bash
+
+# If you want to examine files or run commands for debugging tests,
+# start the container and use `exec` to open an interactive shell--for example:
+# docker start test && docker exec -it test /bin/bash
\ No newline at end of file
diff --git a/test/.gitignore b/test/.gitignore
index 069e8a3cd..4bd5278e4 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,7 +1,9 @@
/target
/Cargo.lock
+content
node_modules
+tmp
.env*
.pytest_cache
.test-run.txt
-tmp
+parse_yaml.sh
diff --git a/test/requirements.txt b/test/requirements.txt
index 33d7077c5..2c42bb011 100644
--- a/test/requirements.txt
+++ b/test/requirements.txt
@@ -1,6 +1,5 @@
## Code sample dependencies
-# Temporary fork for passing headers in query options.
-influxdb3-python @ git+https://github.com/jstirnaman/influxdb3-python@4abd41c710e79f85333ba81258b10daff54d05b0
+influxdb3-python
pandas
## Tabulate for printing pandas DataFrames.
tabulate
diff --git a/test/run-tests.sh b/test/run-tests.sh
index 5bbfba434..ffcf66577 100644
--- a/test/run-tests.sh
+++ b/test/run-tests.sh
@@ -1,10 +1,44 @@
#!/bin/bash
+# Function to check if an option is present in the arguments
+has_option() {
+ local target="$1"
+ shift
+ for arg in "$@"; do
+ if [ "$arg" == "$target" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+verbose=0
+# Check if "--option" is present in the CMD arguments
+if has_option "-v" "$@"; then
+ verbose=1
+ echo "Using verbose mode..."
+fi
+
+if [ -z "$TEMP_DIR" ]; then
+ TEMP_DIR=./tmp
+fi
+
+# Parse YAML config files into dotenv files
+curl -sO https://raw.githubusercontent.com/mrbaseman/parse_yaml/master/src/parse_yaml.sh
+source ./parse_yaml.sh && parse_yaml ./data/products.yml > .env.products
+
+# Load shell environment variables from .env files generated in the build (not provided at build-time.
+# To provide .env files available at build-time, set them in the docker compose file).
+set -a && source .env.products && set +a
+
+cd $TEMP_DIR
+
for file in `find . -type f` ; do
if [ -f "$file" ]; then
echo "PROCESSING $file"
- # Replace placeholder values with environment variables.
+ # Replaces placeholder values with environment variable references.
+
# Non-language-specific replacements.
sed -i 's|https:\/\/{{< influxdb/host >}}|$INFLUX_HOST|g;
' $file
@@ -23,13 +57,40 @@ for file in `find . -type f` ; do
# Shell-specific replacements.
sed -i 's/API_TOKEN/$INFLUX_TOKEN/g;
s/ORG_ID/$INFLUX_ORG/g;
+ s/ORG/$INFLUX_ORG/g;
s/DATABASE_TOKEN/$INFLUX_TOKEN/g;
s/BUCKET_NAME/$INFLUX_DATABASE/g;
s/DATABASE_NAME/$INFLUX_DATABASE/g;
- s/get-started/$INFLUX_DATABASE/g;' \
+ s/get-started/$INFLUX_DATABASE/g;
+ s/CONFIG_NAME/CONFIG_$(shuf -i 0-100 -n1)/g;' \
+ $file
+
+ # v2-specific replacements.
+ sed -i 's|https:\/\/us-west-2-1.aws.cloud2.influxdata.com|$INFLUX_HOST|g;
+ s|{{< latest-patch >}}|${influxdb_latest_patches_v2}|g;
+ s|{{< latest-patch cli=true >}}|${influxdb_latest_cli_v2}|g;' \
+ $file
+
+ # Skip package manager commands.
+ sed -i 's|sudo dpkg.*$||g;
+ s|sudo yum.*$||g;' \
+ $file
+
+ # Environment-specific replacements.
+ sed -i 's|sudo ||g;' \
$file
fi
- cat $file
+ if [ $verbose -eq 1 ]; then
+ echo "FILE CONTENTS:"
+ cat $file
+ fi
done
-pytest --codeblocks .
+# Miscellaneous test setup.
+# For macOS samples.
+mkdir -p ~/Downloads && rm -rf ~/Downloads/*
+# Clean up installed files from previous runs.
+gpg -q --batch --yes --delete-key D8FF8E1F7DF8B07E > /dev/null 2>&1
+
+# Run test commands with options provided in the CMD of the Dockerfile.
+pytest --codeblocks ./content "$@"
\ No newline at end of file