Skip to content

Commit

Permalink
Merge pull request #8755 from killianmuldoon/pr-1.3-mp-timout
Browse files Browse the repository at this point in the history
🐛 [release-1.3] Adjust machinepool helper e2e timeout
  • Loading branch information
k8s-ci-robot committed May 26, 2023
2 parents 1bf24ee + 0874f73 commit 7bbee2d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/framework/machinepool_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"strings"
"time"

"github.com/blang/semver"
. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -240,11 +241,11 @@ func WaitForMachinePoolInstancesToBeUpgraded(ctx context.Context, input WaitForM

log.Logf("Ensuring all MachinePool Instances have upgraded kubernetes version %s", input.KubernetesUpgradeVersion)
Eventually(func() (int, error) {
nn := client.ObjectKey{
mpKey := client.ObjectKey{
Namespace: input.MachinePool.Namespace,
Name: input.MachinePool.Name,
}
if err := input.Getter.Get(ctx, nn, input.MachinePool); err != nil {
if err := input.Getter.Get(ctx, mpKey, input.MachinePool); err != nil {
return 0, err
}
versions := getMachinePoolInstanceVersions(ctx, GetMachinesPoolInstancesInput{
Expand All @@ -261,7 +262,7 @@ func WaitForMachinePoolInstancesToBeUpgraded(ctx context.Context, input WaitForM
}

if matches != len(versions) {
return 0, errors.New("old version instances remain")
return 0, errors.Errorf("old version instances remain. Expected %d instances at version %v. Got version list: %v", len(versions), input.KubernetesUpgradeVersion, versions)
}

return matches, nil
Expand All @@ -286,15 +287,20 @@ func getMachinePoolInstanceVersions(ctx context.Context, input GetMachinesPoolIn
versions := make([]string, len(instances))
for i, instance := range instances {
node := &corev1.Node{}
err := wait.PollImmediate(retryableOperationInterval, retryableOperationTimeout, func() (bool, error) {
err := input.WorkloadClusterGetter.Get(ctx, client.ObjectKey{Name: instance.Name}, node)
if err != nil {
var nodeGetError error
err := wait.PollImmediate(100*time.Millisecond, 10*time.Second, func() (bool, error) {
nodeGetError = input.WorkloadClusterGetter.Get(ctx, client.ObjectKey{Name: instance.Name}, node)
if nodeGetError != nil {
return false, nil //nolint:nilerr
}
return true, nil
})
if err != nil {
versions[i] = "unknown"
if nodeGetError != nil {
// Dump the instance name and error here so that we can log it as part of the version array later on.
versions[i] = fmt.Sprintf("%s error: %s", instance.Name, errors.Wrap(err, nodeGetError.Error()))
}
} else {
versions[i] = node.Status.NodeInfo.KubeletVersion
}
Expand Down

0 comments on commit 7bbee2d

Please sign in to comment.