Commit Graph
7 Commits
Author SHA1 Message Date
29e46a2a6a buddy: Fix incorrect use of loop variables (#16306)
* Fix incorrect use of loop variables

This commit fixes a few occurrences of loop variables being
incorrectly used in the context of Go-routines or (most frequently)
parallel tests. To fix the issues, we create a local copy of the range
variables before the parallel tests (or Go-routine), as suggested in
the documentation of the `testing` package:

https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks

Issues were found using the `loopvarcapture` linter.

Signed-off-by: Roman Tkachenko <roman@goteleport.com>

* fix TestTraceProvider/spans_exported_with_gRPC+TLS

* run TestSSH serially

* operator: Conserve 'created_by' data in user spec

Signed-off-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Renato Costa <renato@cockroachlabs.com>
Co-authored-by: Tim Ross <tim.ross@goteleport.com>
Co-authored-by: Hugo Hervieux <hugo.hervieux@goteleport.com>
2022-09-14 14:31:56 +00:00
Hugo Shaka 14f282152d operator: Fix flaky drift tests (#16269)
Fixes #15815

The drift tests were not suspending the operator reconciliation loop when causing the drift. If the operator reconciles before during the drift setup, we are not testing what we want (the operator creates the resource back in Teleport).

This PR adds the methods `startKubernetesOperator` and `stopKubernetesOperator` on the `testSetup` struct to fix drift tests.
2022-09-12 18:59:35 +00:00
Trent Clarke 9514a313c3 Break DB integration tests out into their own package (#16133)
Making all of our integration tests run in entirely parallel requires
a large engineering effort to enforce test isolation and remove all race
conditions between tests.

A lower-effort alternative may be to split apart the various test suites
into their own Go packages, and test those packages in parallel, even if
the tests inside are still executed serially. Auditing the test suites
for races on system-level resources (e.g. files, ports) is much easier
than chasing down every p[ossible race in the testing system.

This patch acts as a trial run, breaking a fairly well-defined and
self-contained test suite out into its own package. Note that the goal of
this change is not necessarily to shave minutes off the build (although
that would be nice), but to act as an illustration of how other, less
well-formed test suites might be broken apart.

See-Also: #12421
See-Also: #14408
2022-09-07 11:04:35 +10:00
Hugo Shaka 6b3cb0754d Fix a flaky operator test (#15884)
Fixes #15871
2022-08-31 15:20:54 +00:00
Hugo Shaka 65e861daeb Stop validating schema for labels in k8s operator (#15206)
* Stop validating schema for labels (#15204)
* operator: support receiving invalid TeleportRole CRs

This PR makes the controller-runtime manager decode TeleportRole
resource in an unstructured object. This avoid errors during decoding.
The resource is later decoded as a TeleportRole, with proper error
handling.
2022-08-17 03:18:17 +00:00
Edoardo Spadolini 86066c7dac Fix flakiness in TestRoleUpdate (#14884) 2022-07-26 17:01:31 +00:00
Marco Dinis 5effbd8359 Add Teleport operator
This commit adds the Teleport operator. The operator reconciles
TeleportUsers and TeleportRoles Kubernetes resources with Users and
Roles Teleport resources.
2022-07-25 15:27:10 -04:00