mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	test: setup embedded file sources for manifests
Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>
This commit is contained in:
		
							
								
								
									
										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"
 | 
			
		||||
 | 
			
		||||
	"k8s.io/component-base/version"
 | 
			
		||||
	conformancetestdata "k8s.io/kubernetes/test/conformance/testdata"
 | 
			
		||||
	"k8s.io/kubernetes/test/e2e/framework"
 | 
			
		||||
	"k8s.io/kubernetes/test/e2e/framework/config"
 | 
			
		||||
	"k8s.io/kubernetes/test/e2e/framework/testfiles"
 | 
			
		||||
	"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"
 | 
			
		||||
 | 
			
		||||
	// test sources
 | 
			
		||||
@@ -86,10 +89,17 @@ func TestMain(m *testing.M) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Enable bindata file lookup as fallback.
 | 
			
		||||
	// TODO: To be removed once all data sources have been moved to embeds.
 | 
			
		||||
	testfiles.AddFileSource(testfiles.BindataFileSource{
 | 
			
		||||
		Asset:      generated.Asset,
 | 
			
		||||
		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 {
 | 
			
		||||
		var tests []struct {
 | 
			
		||||
			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"
 | 
			
		||||
	e2econfig "k8s.io/kubernetes/test/e2e/framework/config"
 | 
			
		||||
	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"
 | 
			
		||||
	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"
 | 
			
		||||
 | 
			
		||||
	"github.com/onsi/ginkgo"
 | 
			
		||||
@@ -90,12 +93,13 @@ func registerNodeFlags(flags *flag.FlagSet) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	// Enable bindata file lookup as fallback.
 | 
			
		||||
	e2etestfiles.AddFileSource(e2etestfiles.BindataFileSource{
 | 
			
		||||
		Asset:      generated.Asset,
 | 
			
		||||
		AssetNames: generated.AssetNames,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	// Enable embedded FS file lookup as fallback
 | 
			
		||||
	// TODO: This needs to be cleaned up later to include only file sources which are necessary.
 | 
			
		||||
	e2etestfiles.AddFileSource(e2etestingmanifests.GetE2ETestingManifestsFS())
 | 
			
		||||
	e2etestfiles.AddFileSource(e2enodetestingmanifests.GetE2ENodeTestingManifestsFS())
 | 
			
		||||
	e2etestfiles.AddFileSource(testimages.GetTestImagesFS())
 | 
			
		||||
	e2etestfiles.AddFileSource(testfixtures.GetTestFixturesFS())
 | 
			
		||||
	e2etestfiles.AddFileSource(conformancetestdata.GetConformanceTestdataFS())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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",
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user