test

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

Tests

This folder contains automated tests for this Module. All of the tests are written in Go. Most of these are "integration tests" that deploy real infrastructure using Terraform and verify that infrastructure works as expected using a helper library called Terratest.

WARNING WARNING WARNING

Note #1: Many of these tests create real resources in a GCP project and then try to clean those resources up at the end of a test run. That means these tests may cost you money to run! When adding tests, please be considerate of the resources you create and take extra care to clean everything up when you're done!

Note #2: Never forcefully shut the tests down (e.g. by hitting CTRL + C) or the cleanup tasks won't run!

Note #3: We set -timeout 60m on all tests not because they necessarily take that long, but because Go has a default test timeout of 10 minutes, after which it forcefully kills the tests with a SIGQUIT, preventing the cleanup tasks from running. Therefore, we set an overlying long timeout to make sure all tests have enough time to finish and clean up.

Running the tests

Prerequisites
One-time setup

Download Go dependencies using dep:

cd test
dep ensure
Run all the tests
cd test
go test -v -timeout 60m
Run a specific test

To run a specific test called TestFoo:

cd test
go test -v -timeout 60m -run TestFoo

Documentation

Index

Constants

View Source
const DB_NAME = "testdb"
View Source
const DB_PASS = "testpassword"
View Source
const DB_USER = "testuser"
View Source
const KEY_FAILOVER_REPLICA_ZONE = "failoverReplicaZone"
View Source
const KEY_MASTER_ZONE = "masterZone"
View Source
const KEY_PROJECT = "project"
View Source
const KEY_READ_REPLICA_ZONE = "readReplicaZone"
View Source
const KEY_REGION = "region"
View Source
const MYSQL_CREATE_TEST_TABLE_WITH_AUTO_INCREMENT_STATEMENT = "CREATE TABLE IF NOT EXISTS test (id int NOT NULL AUTO_INCREMENT, name varchar(10) NOT NULL, PRIMARY KEY (ID))"
View Source
const MYSQL_INSERT_TEST_ROW = "INSERT INTO test(name) VALUES(?)"
View Source
const OUTPUT_CLIENT_CA_CERT = "client_ca_cert"
View Source
const OUTPUT_CLIENT_PRIVATE_KEY = "client_private_key"
View Source
const OUTPUT_DB_NAME = "db_name"
View Source
const OUTPUT_FAILOVER_INSTANCE_NAME = "failover_instance_name"
View Source
const OUTPUT_FAILOVER_PROXY_CONNECTION = "failover_proxy_connection"
View Source
const OUTPUT_MASTER_CA_CERT = "master_ca_cert"
View Source
const OUTPUT_MASTER_INSTANCE_NAME = "master_instance_name"
View Source
const OUTPUT_MASTER_IP_ADDRESSES = "master_ip_addresses"
View Source
const OUTPUT_MASTER_PRIVATE_IP = "master_private_ip"
View Source
const OUTPUT_MASTER_PROXY_CONNECTION = "master_proxy_connection"
View Source
const OUTPUT_MASTER_PUBLIC_IP = "master_public_ip"
View Source
const OUTPUT_READ_REPLICA_INSTANCE_NAMES = "read_replica_instance_names"
View Source
const OUTPUT_READ_REPLICA_PROXY_CONNECTIONS = "read_replica_proxy_connections"
View Source
const OUTPUT_READ_REPLICA_PUBLIC_IPS = "read_replica_public_ips"
View Source
const POSTGRES_CREATE_TEST_TABLE_WITH_SERIAL = "CREATE TABLE IF NOT EXISTS test (id SERIAL, name varchar(10) NOT NULL, PRIMARY KEY (ID))"
View Source
const POSTGRES_DROP_TEST_TABLE = "DROP TABLE IF EXISTS test"
View Source
const POSTGRES_INSERT_TEST_ROW = "INSERT INTO test(name) VALUES('Grunty') RETURNING id"
View Source
const SQL_EMPTY_TEST_TABLE_STATEMENT = "DELETE FROM test"
View Source
const SQL_QUERY_ROW_COUNT = "SELECT count(*) FROM test"

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL