mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
test: setup embedded file sources for manifests
Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>
This commit is contained in:
parent
3af6329caf
commit
68b334d02b
33
test/conformance/testdata/embed.go
vendored
Normal file
33
test/conformance/testdata/embed.go
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 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 testdata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed conformance.yaml ineligible_endpoints.yaml
|
||||||
|
var conformanceTestdataFS embed.FS
|
||||||
|
|
||||||
|
func GetConformanceTestdataFS() testfiles.EmbeddedFileSource {
|
||||||
|
return testfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: conformanceTestdataFS,
|
||||||
|
Root: "test/conformance/testdata",
|
||||||
|
}
|
||||||
|
}
|
@ -33,10 +33,13 @@ import (
|
|||||||
// "github.com/onsi/ginkgo"
|
// "github.com/onsi/ginkgo"
|
||||||
|
|
||||||
"k8s.io/component-base/version"
|
"k8s.io/component-base/version"
|
||||||
|
conformancetestdata "k8s.io/kubernetes/test/conformance/testdata"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
"k8s.io/kubernetes/test/e2e/framework/config"
|
"k8s.io/kubernetes/test/e2e/framework/config"
|
||||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
"k8s.io/kubernetes/test/e2e/generated"
|
"k8s.io/kubernetes/test/e2e/generated"
|
||||||
|
e2etestingmanifests "k8s.io/kubernetes/test/e2e/testing-manifests"
|
||||||
|
testfixtures "k8s.io/kubernetes/test/fixtures"
|
||||||
"k8s.io/kubernetes/test/utils/image"
|
"k8s.io/kubernetes/test/utils/image"
|
||||||
|
|
||||||
// test sources
|
// test sources
|
||||||
@ -86,10 +89,17 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable bindata file lookup as fallback.
|
// Enable bindata file lookup as fallback.
|
||||||
|
// TODO: To be removed once all data sources have been moved to embeds.
|
||||||
testfiles.AddFileSource(testfiles.BindataFileSource{
|
testfiles.AddFileSource(testfiles.BindataFileSource{
|
||||||
Asset: generated.Asset,
|
Asset: generated.Asset,
|
||||||
AssetNames: generated.AssetNames,
|
AssetNames: generated.AssetNames,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Enable embedded FS file lookup as fallback
|
||||||
|
testfiles.AddFileSource(e2etestingmanifests.GetE2ETestingManifestsFS())
|
||||||
|
testfiles.AddFileSource(testfixtures.GetTestFixturesFS())
|
||||||
|
testfiles.AddFileSource(conformancetestdata.GetConformanceTestdataFS())
|
||||||
|
|
||||||
if framework.TestContext.ListConformanceTests {
|
if framework.TestContext.ListConformanceTests {
|
||||||
var tests []struct {
|
var tests []struct {
|
||||||
Testname string `yaml:"testname"`
|
Testname string `yaml:"testname"`
|
||||||
|
33
test/e2e/testing-manifests/embed.go
Normal file
33
test/e2e/testing-manifests/embed.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 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 testing_manifests
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed flexvolume guestbook kubectl sample-device-plugin.yaml scheduling/nvidia-driver-installer.yaml statefulset storage-csi
|
||||||
|
var e2eTestingManifestsFS embed.FS
|
||||||
|
|
||||||
|
func GetE2ETestingManifestsFS() e2etestfiles.EmbeddedFileSource {
|
||||||
|
return e2etestfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: e2eTestingManifestsFS,
|
||||||
|
Root: "test/e2e/testing-manifests",
|
||||||
|
}
|
||||||
|
}
|
@ -44,8 +44,11 @@ import (
|
|||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2econfig "k8s.io/kubernetes/test/e2e/framework/config"
|
e2econfig "k8s.io/kubernetes/test/e2e/framework/config"
|
||||||
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
"k8s.io/kubernetes/test/e2e/generated"
|
e2etestingmanifests "k8s.io/kubernetes/test/e2e/testing-manifests"
|
||||||
"k8s.io/kubernetes/test/e2e_node/services"
|
"k8s.io/kubernetes/test/e2e_node/services"
|
||||||
|
e2enodetestingmanifests "k8s.io/kubernetes/test/e2e_node/testing-manifests"
|
||||||
|
testfixtures "k8s.io/kubernetes/test/fixtures"
|
||||||
|
testimages "k8s.io/kubernetes/test/images"
|
||||||
system "k8s.io/system-validators/validators"
|
system "k8s.io/system-validators/validators"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
@ -90,12 +93,13 @@ func registerNodeFlags(flags *flag.FlagSet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Enable bindata file lookup as fallback.
|
// Enable embedded FS file lookup as fallback
|
||||||
e2etestfiles.AddFileSource(e2etestfiles.BindataFileSource{
|
// TODO: This needs to be cleaned up later to include only file sources which are necessary.
|
||||||
Asset: generated.Asset,
|
e2etestfiles.AddFileSource(e2etestingmanifests.GetE2ETestingManifestsFS())
|
||||||
AssetNames: generated.AssetNames,
|
e2etestfiles.AddFileSource(e2enodetestingmanifests.GetE2ENodeTestingManifestsFS())
|
||||||
})
|
e2etestfiles.AddFileSource(testimages.GetTestImagesFS())
|
||||||
|
e2etestfiles.AddFileSource(testfixtures.GetTestFixturesFS())
|
||||||
|
e2etestfiles.AddFileSource(conformancetestdata.GetConformanceTestdataFS())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
33
test/e2e_node/testing-manifests/embed.go
Normal file
33
test/e2e_node/testing-manifests/embed.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 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 testing_manifests
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed *.yaml
|
||||||
|
var e2eNodeTestingManifestsFS embed.FS
|
||||||
|
|
||||||
|
func GetE2ENodeTestingManifestsFS() e2etestfiles.EmbeddedFileSource {
|
||||||
|
return e2etestfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: e2eNodeTestingManifestsFS,
|
||||||
|
Root: "test/e2e_node/testing-manifests",
|
||||||
|
}
|
||||||
|
}
|
33
test/fixtures/embed.go
vendored
Normal file
33
test/fixtures/embed.go
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 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 fixtures
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed doc-yaml/user-guide/liveness doc-yaml/user-guide/secrets doc-yaml/user-guide/downward-api doc-yaml/user-guide/update-demo
|
||||||
|
var testFixturesFS embed.FS
|
||||||
|
|
||||||
|
func GetTestFixturesFS() testfiles.EmbeddedFileSource {
|
||||||
|
return testfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: testFixturesFS,
|
||||||
|
Root: "test/fixtures",
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user