1
0
mirror of synced 2026-02-06 19:05:55 +00:00

Use shared envTest for unit tests

Speed up unit tests by using a shared envTest. This requires each
test to use its own namespace to avoid clobbering objects for
other tests. Tests previously took around 8 seconds each, and now
the initial test takes 2 seconds with follow up tests taking less
than a second each.

Also update existing tests that use a fixed namespace to use a
generated namespace.

Share gold file template function with yaml files.

Remove the testClusterMode, and instead rely on MainTest to do
the appropriate test setup and rootArgs flag setup. Move the
rootArg flag setup out of NewTestEnvKubeManager to avoid
side effects.

A follow up change can be to push the individual setups
from NewTestEnvKubeManager() into their respective TestMain since
the harness share little code.

Signed-off-by: Allen Porter <allen@thebends.org>
This commit is contained in:
Allen Porter
2021-08-23 14:17:41 -07:00
parent def92e14ee
commit d45501a129
22 changed files with 165 additions and 122 deletions

View File

@@ -1,2 +1,2 @@
► deleting kustomizations tkfg in tkfg namespace
► deleting kustomizations tkfg in {{ .ns }} namespace
✔ kustomizations deleted

View File

@@ -1,9 +1,9 @@
► annotating GitRepository tkfg in tkfg namespace
► annotating GitRepository tkfg in {{ .ns }} namespace
✔ GitRepository annotated
◎ waiting for GitRepository reconciliation
✔ GitRepository reconciliation completed
✔ fetched revision 6.0.0/627d5c4bb67b77185f37e31d734b085019ff2951
► annotating Kustomization tkfg in tkfg namespace
► annotating Kustomization tkfg in {{ .ns }} namespace
✔ Kustomization annotated
◎ waiting for Kustomization reconciliation
✔ Kustomization reconciliation completed

View File

@@ -1,4 +1,4 @@
► resuming kustomizations tkfg in tkfg namespace
► resuming kustomizations tkfg in {{ .ns }} namespace
✔ kustomizations resumed
◎ waiting for Kustomization reconciliation
✔ Kustomization reconciliation completed

View File

@@ -1,2 +1,2 @@
► suspending kustomizations tkfg in tkfg namespace
► suspending kustomizations tkfg in {{ .ns }} namespace
✔ kustomizations suspended