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

Add csi-sanity tests #2254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ElijahQuinones
Copy link
Member

@ElijahQuinones ElijahQuinones commented Dec 4, 2024

What type of PR is this?

/kind feature

What is this PR about? / Why do we need it?

This PR adds csi-sanity tests to the driver to be enable in CI afterwards.

How was this change tested?

Ran make test-sanity
and received the following results

Ran 76 of 92 Specs in 0.355 seconds
SUCCESS! -- 76 Passed | 0 Failed | 1 Pending | 15 Skipped
--- PASS: TestSanity (0.36s)
PASS
ok  	github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/sanity	1.429s

Does this PR introduce a user-facing change?

Add csi-sanity tests

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 4, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 4, 2024
@ElijahQuinones
Copy link
Member Author

/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 4, 2024
@ElijahQuinones ElijahQuinones added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 4, 2024
Copy link

github-actions bot commented Dec 4, 2024

Code Coverage Diff

File Old Coverage New Coverage Delta
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/controller_modify_volume.go 78.0% 77.4% -0.7

@ElijahQuinones
Copy link
Member Author

/retest

@ElijahQuinones ElijahQuinones force-pushed the sanity branch 2 times, most recently from 1cd6007 to 79b840d Compare December 5, 2024 21:01
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 5, 2024
@ElijahQuinones ElijahQuinones force-pushed the sanity branch 2 times, most recently from e328221 to 508b90e Compare December 6, 2024 22:22
@ElijahQuinones ElijahQuinones removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 6, 2024
tests/sanity/sanity_test.go Show resolved Hide resolved
tests/sanity/sanity_test.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@ElijahQuinones ElijahQuinones force-pushed the sanity branch 3 times, most recently from 3dc7cd8 to 70c4ce9 Compare December 19, 2024 20:48
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 19, 2024
@ElijahQuinones ElijahQuinones force-pushed the sanity branch 2 times, most recently from 45ade56 to 80ddf8b Compare December 22, 2024 01:59
Copy link
Contributor

@AndrewSirenko AndrewSirenko left a comment

Choose a reason for hiding this comment

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

/lgtm

tests/sanity/sanity_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 24, 2024
tests/sanity/fake_sanity_cloud.go Outdated Show resolved Hide resolved
tests/sanity/fake_sanity_cloud.go Outdated Show resolved Hide resolved
tests/sanity/sanity_test.go Outdated Show resolved Hide resolved
tests/sanity/sanity_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 26, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from andrewsirenko. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 26, 2024
"github.com/golang/mock/gomock"
csisanity "github.com/kubernetes-csi/csi-test/v5/pkg/sanity"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/metadata"
d "github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is creating an alias here needed?

If we really need it, let's not set it to something like d. Short names should only be used within a small scope (like a function or loop).

func createMockObjects(mockCtrl *gomock.Controller, mountPath string) (*fakeMounter, *fakeCloud, *fakeMetadataService, *d.MockKubernetesClient) {
fakeMounter := NewFakeMounter()
fakeCloud := NewFakeCloud(*fakeMetadata, mountPath)
fakeKubernetesClient := d.NewMockKubernetesClient(mockCtrl)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're removing mock objects, let's remove all of them. 😄

(I don't want to block the PR over this though)

mounts map[string]string
}

func NewFakeMounter() *fakeMounter {
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking: if we don't need it outside of the package, we can probably make it lowercase e.g., newFakeMounter.

}

func (d *fakeCloud) CreateSnapshot(ctx context.Context, volumeID string, opts *cloud.SnapshotOptions) (*cloud.Snapshot, error) {
snapshotID := fmt.Sprintf("snapshot-%d", rand.New(rand.NewSource(time.Now().UnixNano())).Uint64())
Copy link
Contributor

Choose a reason for hiding this comment

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

EBS snapshots IDs start with snap-.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants