consul/test-integ/peering_commontopo
R.B. Boyer a72f868218
testing/deployer: update deployer to use v2 catalog constructs when requested (#19046)
This updates the testing/deployer (aka "topology test") framework to conditionally 
configure and launch catalog constructs using v2 resources. This is controlled via a 
Version field on the Node construct in a topology.Config. This only functions for a 
dataplane type and has other restrictions that match the rest of v2 (no peering, no 
wanfed, no mesh gateways).

Like config entries, you can statically provide a set of initial resources to be synced 
when bringing up the cluster (beyond those that are generated for you such as 
workloads, services, etc).

If you want to author a test that can be freely converted between v1 and v2 then that 
is possible. If you switch to the multi-port definition on a topology.Service (aka 
"workload/instance") then that makes v1 ineligible.

This also adds a starter set of "on every PR" integration tests for single and multiport 
under test-integ/catalogv2
2023-11-02 14:25:48 -05:00
..
README.md
ac1_basic_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
ac2_disco_chain_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
ac3_service_defaults_upstream_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
ac4_proxy_defaults_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
ac5_1_no_svc_mesh_test.go resource: Require scope for resource registration (#18635) 2023-09-01 09:44:53 -05:00
ac5_2_pq_failover_test.go switch all client nodes in dc2 to dataplane [NET-4299] (#18608) 2023-09-06 23:46:34 +00:00
ac6_failovers_test.go OSS -> CE (community edition) changes (#18517) 2023-08-22 09:46:03 -05:00
ac7_1_rotate_gw_test.go testing/deployer: update deployer to use v2 catalog constructs when requested (#19046) 2023-11-02 14:25:48 -05:00
ac7_2_rotate_leader_test.go CI: lint test-integ (#18875) 2023-09-19 10:05:51 -04:00
commontopo.go testing/deployer: update deployer to use v2 catalog constructs when requested (#19046) 2023-11-02 14:25:48 -05:00
sharedtopology_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00

README.md

CONSUL PEERING COMMON TOPOLOGY TESTS

These peering tests all use a commonTopo (read: "common topology") to enable sharing a deployment of a Consul. Sharing a deployment of Consul cuts down on setup time.

To run these tests, you will need to have docker installed. Next, make sure that you have all the required consul containers built:

make test-compat-integ-setup

Non-Shared CommonTopo Tests

The tests in question are designed in a manner that modifies the topology. As a result, it is not possible to share the testing environment across these tests.

Shared CommonTopo Tests

The tests in question are designed in a manner that does not modify the topology in any way that would interfere with other tests. As a result, it is possible to share the testing environment across these tests.

To run all consul peering tests with no shared topology, run the following command:

cd /path/to/peering_commontopo
go test -timeout=10m -v -no-share-topo . 

To run all peering tests with shared topology only:

cd /path/to/peering_commontopo
go test -timeout=10m -run '^TestSuitesOnSharedTopo' -v . 

To run individual peering topology tests:

cd /path/to/peering_commontopo
go test -timeout=10m -run '^TestSuiteExample' -v -no-share-topo .    

Local Development and Testing

If writing tests for peering with no shared topology, this recommendation does not apply. The following methods below not necessarily need to be implmented. For shared topology tests, all the methods in the sharedTopoSuite interface must be implemented.

  • testName() prepends the test suite name to each test in the test suite.
  • setup() phase must ensure that any resources added to the topology cannot interfere with other tests. Principally by prefixing.
  • test() phase must be "passive" and not mutate the topology in any way that would interfere with other tests.

Common topology peering tests are defined in the test-integ/peering_commontopo/ directory and new peering integration tests should always be added to this location. Adding integration tests that does not modify the topology should always start by invoking

runShareableSuites(t, testSuiteExample)

else

func TestSuiteExample(t *testing.T) {
 ct := NewCommonTopo(t)
 s := &testSuiteExample{}
 s.setup(t, ct)
 ct.Launch(t)
 s.test(t, ct)
}

Some of these tests do mutate in their test() phase, and while they use commonTopo for the purpose of code sharing, they are not included in the "shared topo" tests in sharedtopology_test.go.