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

e2e storage: public API for testsuites, support CSIInlineVolume type for generic resource #85540

Merged
merged 3 commits into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions test/e2e/storage/testpatterns/testpattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ var (
Name: "Inline-volume (default fs)",
VolType: InlineVolume,
}
// DefaultFsEphemeralVolume is TestPattern for "Ephemeral-volume (default fs)"
DefaultFsEphemeralVolume = TestPattern{
Name: "Ephemeral-volume (default fs)",
VolType: CSIInlineVolume,
}
// DefaultFsPreprovisionedPV is TestPattern for "Pre-provisioned PV (default fs)"
DefaultFsPreprovisionedPV = TestPattern{
Name: "Pre-provisioned PV (default fs)",
Expand All @@ -95,6 +100,12 @@ var (
VolType: InlineVolume,
FsType: "ext3",
}
// Ext3EphemeralVolume is TestPattern for "Ephemeral-volume (ext3)"
Ext3EphemeralVolume = TestPattern{
Name: "Ephemeral-volume (ext3)",
VolType: InlineVolume,
FsType: "ext3",
}
// Ext3PreprovisionedPV is TestPattern for "Pre-provisioned PV (ext3)"
Ext3PreprovisionedPV = TestPattern{
Name: "Pre-provisioned PV (ext3)",
Expand All @@ -116,6 +127,12 @@ var (
VolType: InlineVolume,
FsType: "ext4",
}
// Ext4EphemeralVolume is TestPattern for "Ephemeral-volume (ext4)"
Ext4EphemeralVolume = TestPattern{
Name: "Ephemeral-volume (ext4)",
VolType: CSIInlineVolume,
FsType: "ext4",
}
// Ext4PreprovisionedPV is TestPattern for "Pre-provisioned PV (ext4)"
Ext4PreprovisionedPV = TestPattern{
Name: "Pre-provisioned PV (ext4)",
Expand All @@ -138,6 +155,13 @@ var (
FsType: "xfs",
FeatureTag: "[Slow]",
}
// XfsEphemeralVolume is TestPattern for "Ephemeral-volume (xfs)"
XfsEphemeralVolume = TestPattern{
Name: "Ephemeral-volume (xfs)",
VolType: CSIInlineVolume,
FsType: "xfs",
FeatureTag: "[Slow]",
}
// XfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (xfs)"
XfsPreprovisionedPV = TestPattern{
Name: "Pre-provisioned PV (xfs)",
Expand All @@ -162,6 +186,13 @@ var (
FsType: "ntfs",
FeatureTag: "[sig-windows]",
}
// NtfsEphemeralVolume is TestPattern for "Ephemeral-volume (ntfs)"
NtfsEphemeralVolume = TestPattern{
Copy link
Member

Choose a reason for hiding this comment

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

csi is not supported on windows yet. This will probably break windows tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just added it for the sake of completeness. It's not used anywhere yet.

Name: "Ephemeral-volume (ntfs)",
VolType: CSIInlineVolume,
FsType: "ntfs",
FeatureTag: "[sig-windows]",
}
// NtfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (ntfs)"
NtfsPreprovisionedPV = TestPattern{
Name: "Pre-provisioned PV (ntfs)",
Expand Down
10 changes: 8 additions & 2 deletions test/e2e/storage/testsuites/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ filegroup(

go_test(
name = "go_default_test",
srcs = ["base_test.go"],
srcs = [
"api_test.go",
"base_test.go",
],
embed = [":go_default_library"],
deps = ["//test/e2e/framework/volume:go_default_library"],
deps = [
"//test/e2e/framework/volume:go_default_library",
"//test/e2e/storage/testpatterns:go_default_library",
],
)
52 changes: 52 additions & 0 deletions test/e2e/storage/testsuites/api_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package testsuites_test is used intentionally to ensure that the
// code below only has access to exported names. It doesn't have any
// actual test. That the custom volume test suite defined below
// compile is the test.
//
// It's needed because we don't have any in-tree volume test
// suite implementations that aren't in the "testuites" package itself.
// We don't need this for the "TestDriver" interface because there
// we have implementations in a separate package.
package testsuites_test

import (
"k8s.io/kubernetes/test/e2e/framework/volume"
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
)

type fakeSuite struct {
}

func (f *fakeSuite) GetTestSuiteInfo() testsuites.TestSuiteInfo {
return testsuites.TestSuiteInfo{
Name: "fake",
FeatureTag: "",
TestPatterns: []testpatterns.TestPattern{testpatterns.DefaultFsDynamicPV},
SupportedSizeRange: volume.SizeRange{Min: "1Mi", Max: "1Gi"},
}
}

func (f *fakeSuite) DefineTests(testsuites.TestDriver, testpatterns.TestPattern) {
}

func (f *fakeSuite) SkipRedundantSuite(testsuites.TestDriver, testpatterns.TestPattern) {
}

var _ testsuites.TestSuite = &fakeSuite{}
Loading