Categorygithub.com/onsdigital/dp-api-tests
module
0.0.0-20190513142136-e7e71aebf63e
Repository: https://github.com/onsdigital/dp-api-tests.git
Documentation: pkg.go.dev

# README

dp-api-tests

Getting started

These tests should be run against empty databases. To ensure this, your applications should be configured to use a different database. Do this by running the following and then restarting your applications:

export MONGODB_DATABASE=test
export MONGODB_FILTERS_DATABASE=test
export MONGODB_IMPORTS_DATABASE=test

or by running make acceptance instead of make debug to start up the following services:

dp-dataset-api
dp-filter-api
dp-import-api

You will also need to run https://github.com/ONSdigital/dp-auth-api-stub instead of Zebedee.

If you're running applications using websysd ensure InheritEnvironment is set to true in the websysd.json file.

The acceptance tests are split between running in publishing or web and result in different results/responses; by default you should be running the services in publishing.

To test services in publishing run the following command:

cd publishing && go test ./...

To run the web tests, make sure all instances of your API services are running in web and then run the following command:

cd web && go test ./...

Testing standards

All tests should be written in the following structure:

  • Teardown all data related to test
  • Setup all data related to test, do NOT use API's to setup this data, if this fails then the test fails for the wrong reason.
  • Run test
  • Teardown all data related to test

Configuration

An overview of the configuration options available, either as a table of environment variables, or with a link to a configuration guide.

Environment variableDefaultDescription
CODELIST_API_URLhttp://localhost:22400The host name for the Codelist API
DATASET_API_URLhttp://localhost:22000The host name for the Dataset API
DOWNLOAD_SERVICE_URLhttp://localhost:23600The host name for the Download Service
FILTER_API_URLhttp://localhost:22100The host name for the Filter API
HIERARCHY_API_URLhttp://localhost:22600The host name for the Hierarchy API
IMPORT_API_URLhttp://localhost:21800The host name for the Import API
RECIPE_API_URLhttp://localhost:22300The host name for the Recipe API
SEARCH_API_URLhttp://localhost:23100The host name for the Search API
ELASTIC_SEARCH_URLhttp://localhost:9200The host name for elasticsearch
MONGODB_BIND_ADDRlocalhost:27017The MongoDB bind address
MONGODB_DATABASEtestThe Dataset API mongo database
MONGODB_FILTERS_DATABASEtestThe Filter API mongo database
MONGODB_IMPORTS_DATABASEtestThe Import API mongo database
NEO4J_BIND_ADDRbolt://localhost:7687The Neo4j bind address
KAFKA_ADDRlocalhost:9092The list of kafka hosts
IMPORT_OBSERVATIONS_INSERTED_TOPICimport-observations-insertedThe Kafka topic to produce events for the number of inserted observations
OBSERVATION_CONSUMER_GROUPobservation-extractedThe Kafka consumer group to consume observation extracted events from
OBSERVATION_CONSUMER_TOPICobservation-extractedThe Kafka topic to consume observation extracted events from
ENCRYPTION_DISABLEDfalseA boolean flag to identify if encryption of files is disabled or not
VAULT_ADDRhttp://localhost:8200The vault address
VAULT_TOKEN-Vault token required for the client to talk to vault. (Use make debug to create a vault token)
VAULT_PATHsecret/shared/pskThe path where the psks will be stored in for vault

Contributing

See CONTRIBUTING for details.

License

Copyright © 2016-2017, Office for National Statistics (https://www.ons.gov.uk)

Released under MIT license, see LICENSE for details.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author