Skip to main content

Automated BCDC API Testing

Intention is to test the CKAN API after deployment.

Current tests include:

  • verification of preconfigured orgs required for testing
  • CRUD tests for packages.

OCP Build for BCDC-TEST

pulls package from https://pypi.org/project/bcdc-apitests/ new OC build triggered by github actions on commit to master branch

how to create new build from build config

oc create -f https://raw.githubusercontent.com/bcgov/bcdc-test/master/k8s/bcdc-test-buildconfig.yaml

start build

oc start-build bcdc-test -n databcdc

OCP Job Template for BCDC-TEST

example how to run job from template

oc process -f https://raw.githubusercontent.com/bcgov/bcdc-test/master/k8s/bcdc-api-test-job-template.yaml -p BCDC_URL_CONFIG_NAME='cadi-bcdc-url' -p BCDC_API_SECRET_NAME='cadi-bcdc-api-key' -p ENV=dev | oc create -f -"

Required parameters to override in template

BCDC_URL_CONFIG_NAME = <Config Name in OCP to get URL of ckan instance to run against>
BCDC_API_SECRET_NAME = <Secret Name in OCP to get ckan api key>
ENV = <App Env to run in>

OCP Build for BCDC-TEST-DEV

pulls from https://pypi.org/project/bcdc-apitests-dev/ new OC build triggered by github actions on push to dev branch

oc create -f https://raw.githubusercontent.com/bcgov/bcdc-test/master/k8s/bcdc-test-buildconfig-dev.yaml

OC Job Template for BCDC-TEST-DEV

oc process -f https://raw.githubusercontent.com/bcgov/bcdc-test/master/k8s/bcdc-api-test-job-template-development.yaml -p BCDC_URL_CONFIG_NAME='cadi-bcdc-url' -p BCDC_API_SECRET_NAME='cadi-bcdc-api-key' -p ENV=dev | oc create -f -"
Required parameters to override in template

BCDC_URL_CONFIG_NAME = BCDC_API_SECRET_NAME = ENV =


# OC Job Cleanup 
* to be performed on a regular basis to cleanup old pods created by jobs

to view all jobs

oc get job

to delete all jobs by label

oc delete job -l name=ckan-api-test

# Run Tests locally

pip install pypandoc pip install bcdc_apitests export BCDC_API_KEY= export BCDC_URL= pytest --pyargs bcdc_apitests


# Packaging

### disable teardown
`--df` Include this switch if you want to disable teardown that deletes the test 
data that gets generated by the test suite.  The various options basically tell the 
test suite not to delete a particular type of data that are generated by the tests.

Options include:
* *orgs*
* *groups*
* *packages*
* *resources*
* *users*
* *other*
* *ALL*

# Packaging

Packaging is currently configured to be built automatically by github actions when 
a pull request on master has been successfully merged.  

## packaging version numbers

When a new package is built it will automatically check what the last version 
is in PYPI for the package and increment that number.  

Example if the version in pypi is 7.3.45, the next time the github action triggers
it will be 7.3.46.  If you want the change either the major or the minor number
set the number in packages __init__.py file, for example to increment the major
version number to 8.

... version=8.0.0 ...





Metadata

Release files for bcdc-apitests 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bcdc-apitests 1.0.4
File Size Uploaded
bcdc-apitests-1.0.4.tar.gz 73.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bcdc-apitests 1.0.4
File Interpreter ABI Platform
bcdc_apitests-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 172.3 kB

Release files / bcdc-apitests-1.0.4.tar.gz

Download URL bcdc-apitests-1.0.4.tar.gz
Size 73.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8840227e96b32cd494dc940151f8b353cbd158411097602889c5a52da4517b96
BLAKE2b-256 checksum
How to use checksums
d3e012ba734e2c4276d724acd86b2189078e61909c8c8950eda6f2f79fdc8884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / bcdc_apitests-1.0.4-py3-none-any.whl

Download URL bcdc_apitests-1.0.4-py3-none-any.whl
Size 99.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef7e2714825eee76b91d1c82a356c8e0a05f5ed45d0a1f8684a4bd01136da839
BLAKE2b-256 checksum
How to use checksums
876196994328d2890091a517e94f236afe72d7ef637b7de3cb09c9f898d0294d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page