Skip to content

Commit 13b05ee

Browse files
committed
CI | Data Buckets | Test AWS SDK Clients
1. Add to the CI a test that runs basic commands using the most updated AWS SDK client. In this PR it is AWS SDK Go V2 as a start. 2. Add log printings of 'pools_to_create.length' in coretest (helps in debugging in case the nodes/hosts were not created). Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
1 parent 9d86f2e commit 13b05ee

File tree

7 files changed

+514
-0
lines changed

7 files changed

+514
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test AWS SDK Clients
2+
on:
3+
schedule:
4+
- cron: "0 1 * * *"
5+
workflow_dispatch:
6+
7+
jobs:
8+
test-aws-sdk-clients:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 90
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
repository: 'noobaa/noobaa-core'
19+
path: 'noobaa-core'
20+
21+
- name: Run AWS SDK Clients
22+
run: |
23+
set -x
24+
cd ./noobaa-core
25+
make test-aws-sdk-clients
26+
27+

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ build-ssl-postgres: tester
229229
@echo "##\033[1;32m Build image postgres:ssl done.\033[0m"
230230
.PHONY: build-ssl-postgres
231231

232+
build-aws-client: noobaa
233+
@echo "\n##\033[1;32m Build image for AWS Client tests ...\033[0m"
234+
$(CONTAINER_ENGINE) build $(CONTAINER_PLATFORM_FLAG) $(CPUSET) -f src/deploy/NVA_build/AWSClient.Dockerfile $(CACHE_FLAG) $(NETWORK_FLAG) -t noobaa-aws-client . $(REDIRECT_STDOUT)
235+
@echo "\033[1;32mBuild image for AWS Client tests done.\033[0m"
236+
.PHONY: build-aws-client
237+
232238
test: tester
233239
@echo "\033[1;34mRunning tests with Mongo.\033[0m"
234240
@$(call create_docker_network)
@@ -363,6 +369,17 @@ test-external-pg-sanity: build-ssl-postgres
363369
@$(call remove_docker_network)
364370
.PHONY: test-external-pg-sanity
365371

372+
test-aws-sdk-clients: build-aws-client
373+
@echo "\033[1;34mRunning tests with Postgres.\033[0m"
374+
@$(call create_docker_network)
375+
@$(call run_postgres)
376+
@echo "\033[1;34mRunning aws sdk clients tests\033[0m"
377+
$(CONTAINER_ENGINE) run $(CPUSET) --network noobaa-net --name noobaa_$(GIT_COMMIT)_$(NAME_POSTFIX) --env "SUPPRESS_LOGS=$(SUPPRESS_LOGS)" --env "POSTGRES_HOST=coretest-postgres-$(GIT_COMMIT)-$(NAME_POSTFIX)" --env "POSTGRES_USER=noobaa" --env "DB_TYPE=postgres" --env "POSTGRES_DBNAME=coretest" --env "NOOBAA_LOG_LEVEL=all" -v $(PWD)/logs:/logs noobaa-aws-client ./src/test/unit_tests/run_npm_test_on_test_container.sh -c ./node_modules/mocha/bin/mocha.js src/test/unit_tests/different_clients/test_go_sdkv2_script.js
378+
@$(call stop_noobaa)
379+
@$(call stop_postgres)
380+
@$(call remove_docker_network)
381+
.PHONY: test-aws-sdk-clients
382+
366383
clean:
367384
@echo Stopping and Deleting containers
368385
@$(CONTAINER_ENGINE) ps -a | grep noobaa_ | awk '{print $1}' | xargs $(CONTAINER_ENGINE) stop &> /dev/null
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM noobaa
2+
3+
USER 0:0
4+
5+
ENV container=docker
6+
ENV TEST_CONTAINER=true
7+
8+
WORKDIR /root/node_modules/noobaa-core/
9+
10+
# check npm version
11+
RUN npm -v
12+
# install all dependencies (although we would like only the dev dependencies)
13+
RUN npm install
14+
15+
############################################################################
16+
# Layers:
17+
# Title: Install go and modules
18+
# for testing with AWS SDK GO client with most updated version
19+
20+
############################################################################
21+
22+
# installing go
23+
RUN dnf install -y golang
24+
# verify go installation
25+
RUN go version
26+
# set the PATH for go
27+
ENV PATH="/usr/local/go/bin:$PATH"
28+
29+
# install the needed modules
30+
# note: the files go.mod and go.sum will be automatically created after this step in the WORKDIR
31+
RUN go mod init src/test/unit_tests/different_clients
32+
RUN go mod tidy
33+
34+
USER 10001:0

src/test/unit_tests/coretest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ function setup(options = {}) {
233233
});
234234
rpc_client.options.auth_token = token;
235235
await overwrite_system_address(SYSTEM);
236+
console.log('pools_to_create.length', pools_to_create.length);
236237
if (pools_to_create.length > 0) {
237238
await announce('setup_pools()');
238239
await setup_pools(pools_to_create);

0 commit comments

Comments
 (0)