API tests for TACKLE
Using Swagger client for API testing. Will cover basic API test to run sanity or smoke tests against a new build of TACKLE.
PR Reviewer :[email protected]
Maintained by: [email protected]
Refer to Konveyor's Code of Conduct here.
NOTE: You should have minikube/Openshift cluster with Tackle installed
git clone https://github.com/konveyor/tackle-api-tests.git
cd tackle-api-tests
Before running the tests, you need to edit the config.json
file, located in the root directory of the project.
- Provide your GitHub user and token as
cred_git_username
andcred_git_token
which are needed to create credentials and run analysis.
NOTE: You should use a GitHub username that has read permissions to Test Application for Tackle
# Create the Virtual Environment
python3 -m venv ./venv/
# Activate the Virtual Environment just created
source venv/bin/activate
# Install required packages
pip install -r requirements.txt
export TACKLE_USER=?
export TACKLE_PASSWORD=?
export TACKLE_URL=? # including http:// Or https:// and without closing /
# Run tests which marked with @pytest.mark.analysis
python3 -m pytest -v --tc-file=config.json --tc-format=json -m analysis
# If needed, remove existing container
podman rm tests-run
# If needed, remove locally stored image
podman rmi tackle-api-tests
podman build -f Dockerfile -t tackle-api-tests
podman run --name tests-run -e TACKLE_USER=? -e TACKLE_PASSWORD=? -e TACKLE_URL=http://x.x.x.x tackle-api-tests [PYTEST OPTIONS]
# for example:
# podman run --name tests-run -e TACKLE_USER=user -e TACKLE_PASSWORD=pass -e TACKLE_URL=https://1.1.1.1 tackle-api-tests -m tags
cd tackle-api-tests
export PYTHONPATH=$(pwd):$PYTHONPATH
export TACKLE_USER=?
export TACKLE_PASSWORD=?
export TACKLE_URL=? # including http:// Or https:// and without closing /
python3 mta/utils/get-token.py
- Download current stable 2.x.x swagger-codegen-cli tool
# Download current stable 2.x.x branch (Swagger and OpenAPI version 2) wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.29/swagger-codegen-cli-2.4.29.jar -O swagger-codegen-cli.jar
- Download swagger.yaml from konveyor/tackle2-hub
- Edit swagger.yaml file with info and security sections. See example here
- Generate a Python client library
java -jar swagger-codegen-cli.jar generate -i swagger.yaml -l python
- Make sure that
swagger_client.configuration.verify_ssl = False
in order not to verify the SSL/TLS request - For more information see: Swagger Codegen