Skip to content

Commit 2db2c18

Browse files
authored
Define pr and nightly tests (FoundationDB#1635)
* Define a set of tests that should run per pr and on a nightly basis * Update examples on how to run a subset of tests
1 parent fbc4c59 commit 2db2c18

File tree

7 files changed

+72
-9
lines changed

7 files changed

+72
-9
lines changed

e2e/Makefile

+22-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ FEATURE_LOCALITIES?=false
3232
# Make bash pickier about errors.
3333
SHELL=/bin/bash -euo pipefail
3434

35+
# Defines a variable that has the directory of this Makefile as value.
36+
BASE_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
37+
3538
clean:
3639
@rm -f TEST-ginkgo*.xml
3740
@find . -name '*~' | xargs rm -f
@@ -60,7 +63,7 @@ kind-update-operator:
6063
# This makefile reimplements that, and works around a few bugs in ginkgo itself.
6164
ifndef QUIET
6265
VERBOSE=-v
63-
GINKGO_VERBOSE=-ginkgo.v
66+
GINKGO_VERBOSE=--ginkgo.v
6467
else
6568
VERBOSE=
6669
GINKGO_VERBOSE=
@@ -78,9 +81,26 @@ TARGETS=$(patsubst test_%,test_%.run,${SUITES})
7881

7982
run: ${TARGETS}
8083

84+
# This variable can be used to define any label-filter for ginkgo to run a subset of tests.
85+
# For more information see the Ginkgo Spec labels documentation: https://onsi.github.io/ginkgo/#spec-labels.
86+
GINKGO_LABEL_FILTER?=
87+
88+
# Only run tests that are labeled with the "pr" label.
89+
pr-tests: GINKGO_LABEL_FILTER=--ginkgo.label-filter="pr"
90+
91+
# Run the actual pr tests.
92+
pr-tests: run
93+
94+
# Only run tests that are labeled with the "pr" or the "nightly" label.
95+
nightly-tests: GINKGO_LABEL_FILTER=--ginkgo.label-filter="pr || nightly"
96+
97+
# Run the actual nightly tests
98+
nightly-tests: run
99+
81100
%.run: %
82101
go test -timeout=$(TIMEOUT) $(VERBOSE) ./$< \
83102
${NO_COLOR} ${GINKGO_VERBOSE} \
103+
$(GINKGO_LABEL_FILTER) \
84104
--ginkgo.junit-report=$@.xml \
85105
--ginkgo.timeout=$(TIMEOUT) \
86106
--timeout=$(TIMEOUT) \
@@ -100,4 +120,4 @@ run: ${TARGETS}
100120
--feature-unified-image=$(FEATURE_UNIFIED_IMAGE) \
101121
--feature-localities=$(FEATURE_LOCALITIES) \
102122
--feature-dns=$(FEATURE_DNS) \
103-
| grep -v 'constructing many client instances from the same exec auth config can cause performance problems during cert rotation'
123+
| grep -v 'constructing many client instances from the same exec auth config can cause performance problems during cert rotation' &> $(BASE_DIR)/../logs/$<.log

e2e/README.md

+45-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Every test suite has a head in the `*_test.go` file that describes the test case
88
The following command will run all the operator related tests with the default values:
99

1010
```bash
11-
make -C e2e -kj run
11+
make -kj -C e2e run
1212
```
1313

1414
You can also run a specific test suite by providing the name of the test suite:
1515

1616
```bash
17-
make -C e2e -kj test_operator.run
17+
make -C e2e test_operator.run
1818
```
1919

2020
Every test suite will create at least one namespace, HA cluster tests will create all the required namespaces.
@@ -25,7 +25,7 @@ The e2e tests assume that at least one `StorageClass` is present in the target K
2525
You can provide the targeted `StorageClass` as an environment variable:
2626

2727
```bash
28-
STORAGE_CLASS='my-fancy-storage' make -C e2e -kj test_operator.run
28+
STORAGE_CLASS='my-fancy-storage' make -kj -C e2e test_operator.run
2929
```
3030

3131
If the `STORAGE_CLASS` is not set, the operator will take the default `StorageClass` in this cluster.
@@ -67,3 +67,45 @@ You just can rebuild the operator image and push the new image inside the kind c
6767
```bash
6868
make -C e2e kind-update-operator
6969
```
70+
71+
## What is tested
72+
73+
The following section will cover which test suites are run when.
74+
75+
### Test running for PRs
76+
77+
The following tests will be running for each PR:
78+
79+
- [test_operator](./test_operator)
80+
- [test_operator_upgrades](./test_operator_upgrades)
81+
82+
Those are all test suites labeled with the `pr` label.
83+
You can run those test suites with: `make -kj -C e2e pr-tests`
84+
85+
### Tests running regularly
86+
87+
The following tests will be running on a nightly base:
88+
89+
- [test_operator](./test_operator)
90+
- [test_operator_upgrades](./test_operator_upgrades)
91+
- [test_operator_ha_upgrades](./test_operator_ha_upgrades)
92+
- [test_operator_velocity](./test_operator_velocity)
93+
94+
Those are all test suites labeled with the `pr` or the `nightly` label.
95+
You can run those test suites with: `make -kj -C e2e nightly-tests`
96+
97+
### Tests that are not run regularly
98+
99+
Those tests are only run manually:
100+
101+
- [test_operator_creation_velocity](./test_operator_creation_velocity)
102+
- [test_operator_stress](./test_operator_stress)
103+
104+
e.g. these tests will be used to qualify a new release.
105+
You can run all tests with `make -kj -C e2e run`
106+
107+
## How to debug failed PR tests
108+
109+
All test suited will be logging to the `logs` folder in the root of this repository.
110+
If you want to see the current state of a running test you can use `tail`, e.g. `tail -f ./logs/test_operator.log`, to see the progress of the operator tests, the command assumes you are running it from the project directory.
111+
All tests that are started by our CI pipelines will report in the PR with the test status.

e2e/test_operator/operator_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var _ = AfterSuite(func() {
106106
factory.Shutdown()
107107
})
108108

109-
var _ = Describe("Operator", Label("e2e"), func() {
109+
var _ = Describe("Operator", Label("e2e", "pr"), func() {
110110
var availabilityCheck bool
111111

112112
AfterEach(func() {

e2e/test_operator_ha_upgrades/operator_ha_upgrade_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func verifyBouncingIsBlocked() {
139139
}).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).MustPassRepeatedly(30).Should(BeTrue())
140140
}
141141

142-
var _ = Describe("Operator HA Upgrades", Label("e2e"), func() {
142+
var _ = Describe("Operator HA Upgrades", Label("e2e", "nightly"), func() {
143143
BeforeEach(func() {
144144
factory = fixtures.CreateFactory(testOptions)
145145
})

e2e/test_operator_upgrades/operator_upgrades_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func upgradeAndVerify(cluster *fixtures.FdbCluster, expectedVersion string) {
9696
log.Println("Upgrade took:", time.Since(startTime).String())
9797
}
9898

99-
var _ = Describe("Operator Upgrades", Label("e2e"), func() {
99+
var _ = Describe("Operator Upgrades", Label("e2e", "pr"), func() {
100100
BeforeEach(func() {
101101
factory = fixtures.CreateFactory(testOptions)
102102
})

e2e/test_operator_velocity/operator_velocity_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ var _ = AfterSuite(func() {
161161
factory.Shutdown()
162162
})
163163

164-
var _ = Describe("Test Operator Velocity", Label("e2e"), func() {
164+
var _ = Describe("Test Operator Velocity", Label("e2e", "nightly"), func() {
165165
BeforeEach(func() {
166166
Expect(fdbCluster.WaitForReconciliation()).ToNot(HaveOccurred())
167167
})

logs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.log

0 commit comments

Comments
 (0)