Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add integrationtest-sda-doa and build-sda-doa to Makefile #1305

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Parisa68
Copy link
Contributor

Related issue(s) and PR(s)

#901

Description

Testing sda doa locally is now possible. sda-doa uses libraries hosted on GitHub Packages, so make sure your settings.xml is configured with authentication.

How to test

make integrationtest-sda-doa
make build-sda-doa

Copy link
Collaborator

@jbygdell jbygdell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to move as much as possible into the .github/integration/ folder so that everything is in the same place.
While this tests DOA, full interaction with the rest of the stack will also have to be tested to ensure that all containers with a specific tag works together properly.

@@ -36,6 +36,8 @@ build-sda-sftp-inbox:
@cd sda-sftp-inbox && docker build -t ghcr.io/neicnordic/sensitive-data-archive:PR$$(date +%F)-sftp-inbox .
build-sda-admin:
@cd sda-admin && go build
build-sda-doa:
@cd sda-doa && docker build -t ghcr.io/neicnordic/sensitive-data-archive:PR$$(date +%F)-sda-doa .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@cd sda-doa && docker build -t ghcr.io/neicnordic/sensitive-data-archive:PR$$(date +%F)-sda-doa .
@cd sda-doa && docker build -t ghcr.io/neicnordic/sensitive-data-archive:PR$$(date +%F)-doa .

In order to match the rest of the artifacts generated.

@@ -127,6 +129,8 @@ integrationtest-sda-sync-run:
@PR_NUMBER=$$(date +%F) docker compose -f .github/integration/sda-sync-integration.yml run integration_test
integrationtest-sda-sync-down:
@PR_NUMBER=$$(date +%F) docker compose -f .github/integration/sda-sync-integration.yml down -v --remove-orphans
integrationtest-sda-doa:
@cd sda-doa/test/run && sh run_sda_doa_tests.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rework this to match the rest of the test suite i.e.

integrationtest-sda-doa: build-all
	@PR_NUMBER=$$(date +%F) docker compose -f .github/integration/sda-doa-integration.yml run integration_test
	@PR_NUMBER=$$(date +%F) docker compose -f .github/integration/sda-doa-integration.yml down -v --remove-orphans
integrationtest-sda-doa-run:
	@PR_NUMBER=$$(date +%F) docker compose -f .github/integration/sda-doa-integration.yml run integration_test
integrationtest-sda-doa-down:
	@PR_NUMBER=$$(date +%F) docker compose -f .github/integration/sda-doa-integration.yml down -v --remove-orphans

ports:
- 8000:8000
volumes:
- ../../sda-doa/test/mock_auth.py:/mock_auth.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should us the same mock-auth as the pother services, update to match if needed.

container_name: doa
build:
context: ../../sda-doa
dockerfile: ../../sda-doa/Dockerfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dockerfile: ../../sda-doa/Dockerfile

Implicit and should not be needed

Comment on lines +98 to +100
links:
- rabbitmq
- postgres
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
links:
- rabbitmq
- postgres

Handled by proper configuration.

volumes:
- client_certs:/certs
- ../../sda-doa/test/body.enc:/test/body.enc
- ../../sda-doa/outbox:/outbox
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't write data to the repository, always use the system temp for this.

container_name: doa
build:
context: ../../sda-doa
dockerfile: ../../sda-doa/Dockerfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dockerfile: ../../sda-doa/Dockerfile

Comment on lines +124 to +126
links:
- rabbitmq
- postgres
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
links:
- rabbitmq
- postgres

Comment on lines +138 to +139
- OPENID_CONFIGURATION_URL=http://mockauth:8000/openid-configuration
- USERINFO_ENDPOINT_URL=http://mockauth:8000/userinfo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- OPENID_CONFIGURATION_URL=http://mockauth:8000/openid-configuration
- USERINFO_ENDPOINT_URL=http://mockauth:8000/userinfo
- OPENID_CONFIGURATION_URL=http://localhost:8000/openid-configuration
- USERINFO_ENDPOINT_URL=http://localhost:8000/userinfo

Comment on lines +1 to +49
#!/bin/bash

cd "$(dirname "$0")/../.." || exit 1

PR_NUMBER=$(date +%F)
export PR_NUMBER

storage_types=("posix" "s3")

show_spinner() {
printf "\033[33;7mStarting up services...\033[0m\n"
for ((i = 0; i < 25; i++)); do
for s in / - \\ \|; do
printf "\r\033[33m%s\033[0m" "$s"
sleep 0.1
done
done
echo ""
}

for storage_type in "${storage_types[@]}"; do
printf "\033[0;35mRunning test for %s \033[0m\n" "$storage_type"
docker compose -f ../.github/integration/sda-doa-"$storage_type"-outbox.yml -p sda-doa up -d
show_spinner


for script in "test/setup"/*.sh; do
echo "Running $script..."
bash "$script"
done

if [[ $storage_type == "posix" ]]; then
export OUTBOX_TYPE="POSIX"
else
export OUTBOX_TYPE="S3"
fi

if ! mvn test; then
echo "Tests failed for $storage_type. Stopping."
fi

docker compose -f ../.github/integration/sda-doa-"$storage_type"-outbox.yml down -v
unset OUTBOX_TYPE
[[ $storage_type == "posix" ]] && rm -rf outbox

rm -rf test/crypt4gh
done
unset PR_NUMBER

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants