Ensure tests call helm uninstall to remove all resources on teardown #122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has multiple fixes:
Tests that were not calling
helm uninstall <helm-release>
were leaving resources in the cluster such asClusterRole
andClusterRoleBindings
that would conflict with follow up tests that also hadrbac.create: true
, causing test failureschunk-rollover test:
a) MacOS Run Fix - Updated the test to remove in-place seds (
sed -i
) as the sed -i option works differently on a mac. One in-place sed was replaced by using an environment variable in the config, the other just passes it's output directly tokubectl apply -f -
b) this test specifically had created it's own rbac files that were providing the same permissions as the ones that can be created via the helm with
rbac.create: true
. It was also not cleaning these up afterwards and leaving them around in cluster scope with the same name as the ones that would be created via the helm chart (if you do not use a fullnameOverride). Since this is the first test to run, any test after this that hadrbac.create: true
would fail to run. The individualized logic to add these resources to the cluster has been removed, along with these files, andrbac.create:true
has been set in the test'sfluentbit-basic.yaml
file. The helm clean-up as described in 1) cleans these up so there are not conflicts with tests afterwards.c) this test should probably be reviewed in the future. There's a forced 3 minute sleep that checks every 10s for pods that aren't running (via
--field-selector=status.phase!=Running
). Pods could restart and be back in phase running within 10 seconds (if i'm not mistaken), so not sure if the intent was to check for crashes/restarts but I don't think this would work. All it seems like it's doing right now is making full CI runs take an 3 extra minutes.kubernetes-plugins test:
a) did some re-organization for future tests by adding a common
deploy_fluent_bit
function. This will set aFLUENTBIT_POD_NAME
that can be used by tests.b) I was running into a weird label search (k8s pod list) return timing issue when using
run kubectl get pods -l "app.kubernetes.io/name=fluent-bit" -o jsonpath='{.items[0].spec.nodeName}'
immediately after checking that a pod was running, in which this could return a failure that the jsonpath would not match (because the k8s pod list being returned hadnot been updated yet?). If we don't attempt to search by the label and just use the exact fluent-bit pod's name we don't run into the timing issue.skip opensearch hosted test when the
$HOSTED_OPENSEARCH_HOST
islocalhost
, this is to fix the test when running the full suite of tests from a local kind cluster and not through CI.