cluster-api-provider-aws icon indicating copy to clipboard operation
cluster-api-provider-aws copied to clipboard

🌱 Try to fix test flake in which secret is not yet available

Open AndiDog opened this issue 4 months ago • 7 comments
trafficstars

What type of PR is this?

/kind flake

What this PR does / why we need it:

There seems to be one flake that keeps reappearing:

=== RUN   TestAWSMachinePoolReconciler/Reconciling_an_AWSMachinePool/ReconcileLaunchTemplate_not_mocked/launch_template_and_ASG_created_from_zero,_then_bootstrap_config_reference_changes
E0624 07:12:01.962501   46441 awsmachinepool_controller.go:341] "failed to reconcile launch template" err="failed to retrieve bootstrap data secret bootstrap-data-new for AWSMachinePool default/test: Secret \"bootstrap-data-new\" not found"
    awsmachinepool_controller_test.go:966: 
        Expected success, but got an error:
            <*errors.withStack | 0xc002129788>: 
            failed to retrieve bootstrap data secret bootstrap-data-new for AWSMachinePool default/test: Secret "bootstrap-data-new" not found
            {
                error: <*errors.withMessage | 0xc0025847c0>{
                    cause: <*errors.StatusError | 0xc0021214a0>{
                        ErrStatus: {
                            TypeMeta: {Kind: "", APIVersion: ""},
                            ListMeta: {
                                SelfLink: "",
                                ResourceVersion: "",
                                Continue: "",
                                RemainingItemCount: nil,
                            },
                            Status: "Failure",
                            Message: "Secret \"bootstrap-data-new\" not found",
                            Reason: "NotFound",
                            Details: {
                                Name: "bootstrap-data-new",
                                Group: "",
                                Kind: "Secret",
                                UID: "",
                                Causes: nil,
                                RetryAfterSeconds: 0,
                            },
                            Code: 404,
                        },
                    },
                    msg: "failed to retrieve bootstrap data secret bootstrap-data-new for AWSMachinePool default/test",
                },
                stack: [0x24c366e, 0x2547151, 0x26e6bbe, 0x26fb374, 0x556854, 0x480101],
            }

This change tries to work around by waiting for the Secret to be available.

Special notes for your reviewer:

I couldn't reproduce the flake locally, so this is a guess.

Checklist:

  • [x] squashed commits
  • [ ] includes documentation
  • [ ] includes emoji in title
  • [ ] adds unit tests
  • [ ] adds or updates e2e tests

Release note:

NONE

AndiDog avatar Jun 24 '25 08:06 AndiDog