项目作者: bcgov

项目描述 :
Automated testing for BC Data Catalogue
高级语言: Python
项目地址: git://github.com/bcgov/bcdc-test.git
创建时间: 2019-05-13T23:13:22Z
项目社区:https://github.com/bcgov/bcdc-test

开源协议:Apache License 2.0

下载


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

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

start build

  1. oc start-build bcdc-test -n databcdc

OCP Job Template for BCDC-TEST

example how to run job from template

  1. 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

  1. BCDC_URL_CONFIG_NAME = <Config Name in OCP to get URL of ckan instance to run against>
  2. BCDC_API_SECRET_NAME = <Secret Name in OCP to get ckan api key>
  3. 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

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

OC Job Template for BCDC-TEST-DEV

  1. 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 -"
  1. Required parameters to override in template

BCDC_URL_CONFIG_NAME =
BCDC_API_SECRET_NAME =
ENV =

  1. # OC Job Cleanup
  2. * to be performed on a regular basis to cleanup old pods created by jobs
  3. to view all jobs

oc get job

  1. to delete all jobs by label

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

  1. # Run Tests locally

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

  1. # Packaging
  2. ### disable teardown
  3. `--df` Include this switch if you want to disable teardown that deletes the test
  4. data that gets generated by the test suite. The various options basically tell the
  5. test suite not to delete a particular type of data that are generated by the tests.
  6. Options include:
  7. * *orgs*
  8. * *groups*
  9. * *packages*
  10. * *resources*
  11. * *users*
  12. * *other*
  13. * *ALL*
  14. # Packaging
  15. Packaging is currently configured to be built automatically by github actions when
  16. a pull request on master has been successfully merged.
  17. ## packaging version numbers
  18. When a new package is built it will automatically check what the last version
  19. is in PYPI for the package and increment that number.
  20. Example if the version in pypi is 7.3.45, the next time the github action triggers
  21. it will be 7.3.46. If you want the change either the major or the minor number
  22. set the number in packages __init__.py file, for example to increment the major
  23. version number to 8.


version=8.0.0

```