From f8fb3fae0f2e7001060174984d71c6ae89986c8b Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Mon, 26 Feb 2024 18:27:27 -0800 Subject: [PATCH] Add security plugin changes (#160) Signed-off-by: Prudhvi Godithi --- .github/workflows/test.yml | 4 ++-- README.md | 1 + docker-compose.yml | 1 + provider/provider_test.go | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 657c82d..069fecb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -91,13 +91,13 @@ jobs: - name: Wait for OpenSearch # ensure that OS has come up and is available run: | - ./script/wait-for-endpoint --timeout=20 http://admin:admin@localhost:9200 + ./script/wait-for-endpoint --timeout=60 http://admin:myStrongPassword123%40456@localhost:9200 - name: Dump docker logs on failure if: failure() uses: jwalton/gh-docker-logs@v2 - name: Run the tests run: | - export OPENSEARCH_URL=http://admin:admin@localhost:9200 + export OPENSEARCH_URL=http://admin:myStrongPassword123%40456@localhost:9200 export TF_LOG=INFO TF_ACC=1 go test ./... -v -parallel 20 -cover -short # check goreleaser config for deprecations diff --git a/README.md b/README.md index 5026249..bafb0f7 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ export OPENSEARCH_URL=http://admin:admin@localhost:9200 export TF_LOG=INFO TF_ACC=1 go test ./... -v -parallel 20 -cover -short ``` +Note: Starting from version `2.12.0`, the `admin` user password is determined by the `OPENSEARCH_INITIAL_ADMIN_PASSWORD` environment variable. If testing against a cluster with version `2.12.0` or later and have set `OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123@456`, please update the URL as follows: `export OPENSEARCH_URL=http://admin:myStrongPassword123%40456@localhost:9200` #### To Run Specific Test ```sh diff --git a/docker-compose.yml b/docker-compose.yml index 1b58279..19bf76d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: - network.publish_host=127.0.0.1 - logger.org.opensearch=warn - "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g" + - "OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123@456" - "plugins.security.ssl.http.enabled=false" - ${OSS_ENV_VAR:-FOO=bar} command: ${OS_COMMAND} diff --git a/provider/provider_test.go b/provider/provider_test.go index 7aa8f48..615e2bf 100644 --- a/provider/provider_test.go +++ b/provider/provider_test.go @@ -46,7 +46,7 @@ func init() { opendistroOriginalConfigureFunc := testAccOpendistroProvider.ConfigureContextFunc testAccOpendistroProvider.ConfigureContextFunc = func(c context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { - err := d.Set("url", "http://admin:admin@127.0.0.1:9200") + err := d.Set("url", os.Getenv("OPENSEARCH_URL")) if err != nil { return nil, diag.FromErr(err) }