Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit hacks in a test that tries to reproduce the issue in tektoncd#2815. Even then, it only reproduced the issue every once in a while - running doit.sh will usually cause the test to fail eventually (but it's running a test that spawns 200 subtests 1000 times!) (The other way to more easily make this failure happen is to introduce a sleep into InformedWatcher.addConfigMapEvent, i.e. delay processing of the config map by the config store such that the test code always executes first.) I believe that what is happening is: 1. When the config store informed watcher starts, it starts go routines to handle incoming events 2. When this all starts for the first time, the shared informer will trigger "on changed" (added) events for the config maps so that the config store will process their values. 3. There is a race: if the goroutines started in (1) happen after the assertions in the test, then the config store will not be updated with the config map values and will resort to the defaults (i.e. not the CONFIGURED default in the configmap, but the harded coded fallback default, literally `default` in the case of the service account What this means is that there is a (very small) chance that if a TaskRun is created immediately after a controller starts up, the config store might not have yet loaded the default values and will create the TaskRun using the fall back hard coded default values and not whatever is configured in the config maps (this would apply to all values configurable via config maps). I think this might be the same problem that is causing the knative/pkg folks to see a flakey test knative/pkg#1907 If you look at the code that fails in that case: https://github.com/knative/pkg/blob/c5296cd61e9f34e183f8010a40dc866f895252b9/configmap/informed_watcher_test.go#L86-L92 The comment says: > When Start returns the callbacks should have been called with the version of the objects that is available. So it seems the intention is that when Start returns, the callbacks have been called (and in the config store case, this means the callbacks that process the config map), but the flakes in this test and the knative test are showing that this isn't the case. I think the fix is to introduce that guarantee; i.e. that after Start has returned, the callbacks have been called with the available version of the objects.
- Loading branch information