Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Improve e2e tests #4631

Merged
merged 43 commits into from
Jul 17, 2024
Merged

test: Improve e2e tests #4631

merged 43 commits into from
Jul 17, 2024

Conversation

r2k1
Copy link
Contributor

@r2k1 r2k1 commented Jul 12, 2024

  • Reorganize scenarios.
    1. Better integration with IDE. Easier to debug a single test
      image

    2. Easier to follow the test logic. Execution sequence is more straightforward.

  • Add VMSS garbage collection. VMSS older than 100 minutes are deleted on startup. Currently each interrupted scenario may leave a VMSS that's deleted days later.
  • Allow tests filtering by VHD. (VHD OS name is passed as a tag to a test)
  • Fetch node bootstrapping config once per cluster instead of once per test.
  • Use t.Log instead of log.Print. Group logs by test, helps with log mixing due to parallel test execution

e2e/cluster.go Outdated
return VNet{}, fmt.Errorf("failed to find aks vnet")
}

func collectGarbageVMSS(ctx context.Context, cluster *armcontainerservice.ManagedCluster) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the pointer!

Model *armcontainerservice.ManagedCluster
Kube *Kubeclient
SubnetID string
NodeBootstrappingConfiguration *datamodel.NodeBootstrappingConfiguration
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is new

@coveralls
Copy link

coveralls commented Jul 12, 2024

Pull Request Test Coverage Report for Build 9966466119

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 71.021%

Totals Coverage Status
Change from base Build 9963078794: 0.0%
Covered Lines: 2566
Relevant Lines: 3613

💛 - Coveralls

})
}

func getContainerdManifestVersion() string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to helpers?

e2e/vmss.go Outdated
return nil, fmt.Errorf("begin create VMSS %q: %w", vmssName, err)
var respErr *azcore.ResponseError
// sometimes the SKU is not available and we can't do anything. Skip the test in this case.
if config.SkipTestsWithSKUCapacityIssue && errors.As(err, &respErr) && respErr.StatusCode == 409 && respErr.ErrorCode == "SkuNotAvailable" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract logic to check for SkuNotAvailable to a helper to make this a bit more readable?

nbc.ContainerdVersion = "1.6.9"
},
LiveVMValidators: []*LiveVMValidator{
containerdVersionValidator(getContainerdManifestVersion()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I didn't change this test yet. Now the containerd version should always come from components.json. I haven't removed the containerd version from manifest.json yet.
Feel free to change it or I will do that after your PR get merged.

nbc.AgentPoolProfile.Distro = "aks-azurelinux-v2-arm64-gen2"
nbc.IsARM64 = true
},
VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe in a follow-up you can rename VMConfigMutator to VMSSModelMutator to make it a bit more clear?

nbc.AgentPoolProfile.Distro = "aks-azurelinux-v2-gen2"
},
LiveVMValidators: []*LiveVMValidator{
serviceCanRestartValidator("chronyd", 10),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe something else you can look at, let's have validators either consistently be exported or unexported, not a mixture of both

fine with just having them be unexported since we've moved them to the e2e package at this point

nbc.ContainerService.Properties.AgentPoolProfiles[0].Distro = "aks-ubuntu-containerd-22.04-gen2"
nbc.AgentPoolProfile.VMSize = vmSize
nbc.AgentPoolProfile.Distro = "aks-ubuntu-containerd-22.04-gen2"
nbc.ConfigGPUDriverIfNeeded = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another example I think where helpers would be beneficial for ease of test authorship,

e.g. WithGPUDriverInstallation

@r2k1 r2k1 enabled auto-merge (squash) July 16, 2024 22:51
@r2k1 r2k1 merged commit 0afccdd into master Jul 17, 2024
17 checks passed
@r2k1 r2k1 deleted the r2k1/e2e branch July 17, 2024 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants