From 02c73d75d53f80208b81ed46c85577713993a5cc Mon Sep 17 00:00:00 2001 From: Tanner Jones <78619684+tannerjones4075@users.noreply.github.com> Date: Wed, 4 Oct 2023 08:30:37 -0800 Subject: [PATCH] tannerjones4075- update developer guide (#385) * Updating DEVELOPER_GUIDE.md file to include docker build instructions Signed-off-by: Tanner Jones * Updating DEVELOPER_GUIDE.md file to include docker build instructions Signed-off-by: Tanner Jones * Updating DEVELOPER_GUIDE.md file and CHANGELOG Signed-off-by: Tanner Jones * Removed link from localhost:9200 Signed-off-by: Tanner Jones --------- Signed-off-by: Tanner Jones --- CHANGELOG.md | 1 + DEVELOPER_GUIDE.md | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a048330b..8bd52f049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Read, close and replace the http Reponse Body ([#300](https://github.com/opensearch-project/opensearch-go/pull/300)) - Updated and adjusted golangci-lint, solve linting complains for signer ([#352](https://github.com/opensearch-project/opensearch-go/pull/352)) - Solve linting complains for opensearchtransport ([#353](https://github.com/opensearch-project/opensearch-go/pull/353)) +- Updated Developer guide to include docker build instructions ([#385]https://github.com/opensearch-project/opensearch-go/pull/385) ### Deprecated diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index b0a897e21..60e0af8b4 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -7,9 +7,10 @@ - [Windows](#windows) - [Unit Testing](#unit-testing) - [Integration Testing](#integration-testing) + - [Composing an OpenSearch Docker Container](#composing-an-opensearch-docker-container) - [Execute integration tests from your terminal](#execute-integration-tests-from-your-terminal) - - [Lint](#lint) - - [Markdown lint](#markdown-lint) + - [Lint](#lint) + - [Markdown lint](#markdown-lint) - [Use an Editor](#use-an-editor) - [GoLand](#goland) @@ -61,6 +62,19 @@ go test -v -run TestName; In order to test opensearch-go client, you need a running OpenSearch cluster. You can use Docker to accomplish this. The [Docker Compose file](.ci/opensearch/docker-compose.yml) supports the ability to run integration tests for the project in local environments. If you have not installed docker-compose, you can install it from this [link](https://docs.docker.com/compose/install/). +### Composing an OpenSearch Docker Container + +Ensure that Docker is installed on your local machine. You can check by running `docker --version`. Next, navigate to your local OpenSearch repository where the docker-compose.yaml file is stored. Run the following command to build the docker container. + +``` +cd opensearch/.ci/opensearch +docker-compose -f docker-compose.yml up +``` + +This command will start the OpenSearch container using the `docker-compose.yaml` configuration file. During the build process, the necessary dependencies and files will be downloaded, which may take some time depending on your internet connection and system resources. + +Once the container is built and running, you can open a web browser and navigate to localhost:9200 to access the OpenSearch docker container. + In order to differentiate unit tests from integration tests, Go has a built-in mechanism for allowing you to logically separate your tests with [build tags](https://pkg.go.dev/cmd/go#hdr-Build_constraints). The build tag needs to be placed as close to the top of the file as possible, and must have a blank line beneath it. Hence, create all integration tests with build tag 'integration'. #### Execute integration tests from your terminal