Use test namespaces with numeric suffix#5337
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5337 +/- ##
==========================================
+ Coverage 82.28% 82.61% +0.32%
==========================================
Files 194 194
Lines 6002 6004 +2
==========================================
+ Hits 4939 4960 +21
+ Misses 739 720 -19
Partials 324 324
Continue to review full report at Codecov.
|
* prevents import cycle when flags are accessed directly from the lib package
| func makeK8sNamespace(baseFuncName string) string { | ||
| base := helpers.MakeK8sNamePrefix(baseFuncName) | ||
| return names.SimpleNameGenerator.GenerateName(base + "-") | ||
| func CreateNamespacedClient(t *testing.T) (*Client, error) { |
There was a problem hiding this comment.
FYI: we intend to delete this lib and have it be replaced with knative-sandbox/reconciler-test
There was a problem hiding this comment.
Yeah. OK. But the previous attempt that I abandoned because of this new framework coming was 11 months ago (#3313). If I understand it correctly, the majority of tests are still using this old style so it would be good to have some solution until we actually migrate everything to the new framework.
|
/hold |
* also make the retry count and interval shorter to speed up things
* leave previously existing namespaces there
|
Is this still on |
|
@matzew thanks for reminding me. There was enough time and I think this is ready for review /hold cancel |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: matzew, mgencur The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* Use test namespaces from pre-defined range * ReuseNamespace flag * ReuseNamespace variable in lib package * prevents import cycle when flags are accessed directly from the lib package * Fix gofmt * Fix goimports * Remove the last occurrence of import cycle * Remove unused variable * Fix detection of NotFound api error * also make the retry count and interval shorter to speed up things * Delete NS only if we created it * leave previously existing namespaces there * Call CreateNamespaceWithRetry directly
* Use test namespaces with numeric suffix (knative#5337) * Use test namespaces from pre-defined range * ReuseNamespace flag * ReuseNamespace variable in lib package * prevents import cycle when flags are accessed directly from the lib package * Fix gofmt * Fix goimports * Remove the last occurrence of import cycle * Remove unused variable * Fix detection of NotFound api error * also make the retry count and interval shorter to speed up things * Delete NS only if we created it * leave previously existing namespaces there * Call CreateNamespaceWithRetry directly * Run conformance tests as project admin (knative#5596) * Create RBAC according to the test namespace * most tests will use just the serviceAccount that has the same name as the test namespace * tests using ApiServerSource will user serviceAccount that is named as follows: ${namespace}-eventwatcher * Script for creating necessary RBAC for conformance tests * Readme for running Conformance tests as project admin * Fix imports * Minor update for readme * Fix goimport * Do not fail if ServiceAccount already exists * Fix goftm * Mark tests requiring cluster-admin with specific build tag * Move the creation of SA,Role,RoleBinding close to namespace creation * since the name of the resources is aligned with the name of the namespace it makes sense to create them only once, at the same time as the namespace * Formatting * Move remaining creation of SA,Role,RoleBinding
Fixes #2776
Proposed Changes
The individual tests still create some resources that require admin privileges. This would be resolved in the next PR. Related discussion in #5357
Pre-review Checklist
Release Note
Docs