Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Flaky test in the unittests job #4405

Open
srm09 opened this issue Feb 16, 2023 · 2 comments
Open

Flaky test in the unittests job #4405

srm09 opened this issue Feb 16, 2023 · 2 comments
Labels

Comments

@srm09
Copy link
Contributor

srm09 commented Feb 16, 2023

Bug description
Seen this test fail multiple times when running the unit tests job

• Failure [13.309 seconds]
ClusterBootstrap Reconciler
/home/runner/work/tanzu-framework/tanzu-framework/addons/controllers/clusterbootstrap_controller_test.go:42
  when cluster is created from clusterBootstrapTemplate
  /home/runner/work/tanzu-framework/tanzu-framework/addons/controllers/clusterbootstrap_controller_test.go:781
    from a ClusterBootstrapTemplate
    /home/runner/work/tanzu-framework/tanzu-framework/addons/controllers/clusterbootstrap_controller_test.go:787
      should perform ClusterBootstrap reconciliation & block reconciliation if ClusterBootstrap gets paused [It]
      /home/runner/work/tanzu-framework/tanzu-framework/addons/controllers/clusterbootstrap_controller_test.go:788

      Expected
          <bool>: true
      not to be true
      /home/runner/work/tanzu-framework/tanzu-framework/addons/controllers/clusterbootstrap_controller_test.go:914

Affected product area (please put an X in all that apply)

  • ( ) APIs
  • ( ) Addons
  • ( ) CLI
  • ( ) Docs
  • ( ) IAM
  • ( ) Installation
  • ( ) Plugin
  • ( ) Security
  • (x) Test and Release
  • ( ) User Experience
  • ( ) Developer Experience

Expected behavior

@srm09 srm09 added kind/bug PR/Issue related to a bug needs-triage Indicates an issue or PR needs to be triaged labels Feb 16, 2023
@srm09
Copy link
Contributor Author

srm09 commented Feb 16, 2023

@srm09
Copy link
Contributor Author

srm09 commented Feb 16, 2023

Rewriting this assertion https://github.com/vmware-tanzu/tanzu-framework/blame/bd3036ea658d6b7b0fc394ed796c98274b56bdb4/addons/controllers/clusterbootstrap_controller_test.go#L908-L916 might be helpful

// Wait 10 seconds in case reconciliation happens
// time.Sleep(10 * time.Second) <========= Remove this

Eventually(func() bool {
	remoteSecret := &corev1.Secret{}
	if err := k8sClient.Get(ctx, client.ObjectKey{Namespace: constants.TKGSystemNS, Name: util.GenerateDataValueSecretName(clusterName, foobar1CarvelPackageRefName)}, remoteSecret); err != nil {
		return false
	}
	// values.yaml should not update
	if string(s.Data["values.yaml"]) == string(remoteSecret.Data["values.yaml"]) {
		return false
	}
	return true
}, waitTimeout, pollingInterval).Should(BeTrue())// Wait 10 seconds in case reconciliation happens

only to confirm if the above assertion is what the original intention was

Note No need for the timeout since Eventually will keep retrying until the assertion is met or the timeout occurs whichever is first.

@codegold79 codegold79 added area/testing area/addons and removed needs-triage Indicates an issue or PR needs to be triaged labels Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants