本文整理汇总了Golang中github.com/openshift/origin/test/extended/util.FixturePath函数的典型用法代码示例。如果您正苦于以下问题:Golang FixturePath函数的具体用法?Golang FixturePath怎么用?Golang FixturePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FixturePath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: jenkinsJobBytes
func jenkinsJobBytes(filename, namespace string) []byte {
pre := exutil.FixturePath("fixtures", filename)
post := exutil.ArtifactPath(filename)
err := exutil.VarSubOnFile(pre, post, "PROJECT_NAME", namespace)
o.Expect(err).NotTo(o.HaveOccurred())
data, err := ioutil.ReadFile(post)
o.Expect(err).NotTo(o.HaveOccurred())
return data
}
示例2: readJenkinsJob
// Returns the content of a Jenkins job XML file. Instances of the
// string "PROJECT_NAME" are replaced with the specified namespace.
func (j *JenkinsRef) readJenkinsJob(filename, namespace string) string {
pre := exutil.FixturePath("testdata", "jenkins-plugin", filename)
post := exutil.ArtifactPath(filename)
err := exutil.VarSubOnFile(pre, post, "PROJECT_NAME", namespace)
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
data, err := ioutil.ReadFile(post)
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
return string(data)
}
示例3: ReadJenkinsJobUsingVars
// ReadJenkinsJobUsingVars returns the content of a Jenkins job XML file. Instances of the
// string "PROJECT_NAME" are replaced with the specified namespace.
// Variables named in the vars map will also be replaced with their
// corresponding value.
func (j *JenkinsRef) ReadJenkinsJobUsingVars(filename, namespace string, vars map[string]string) string {
pre := exutil.FixturePath("testdata", "jenkins-plugin", filename)
post := exutil.ArtifactPath(filename)
if vars == nil {
vars = map[string]string{}
}
vars["PROJECT_NAME"] = namespace
err := exutil.VarSubOnFile(pre, post, vars)
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
data, err := ioutil.ReadFile(post)
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
return string(data)
}
示例4:
})
g.AfterEach(func() {
exutil.ResetImage(resetData)
})
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Context("\n FORCE PULL TEST: when s2i force pull is false and the image is bad", func() {
g.It("\n FORCE PULL TEST s2i false", func() {
fpFalseS2I := exutil.FixturePath("fixtures", "forcepull-false-s2i.json")
g.By(fmt.Sprintf("\n%s FORCE PULL TEST s2i false: calling create on %s", time.Now().Format(time.RFC850), fpFalseS2I))
exutil.StartBuild(fpFalseS2I, buildPrefix, oc)
exutil.WaitForBuild("FORCE PULL TEST s2i false: ", buildName, oc)
exutil.VerifyImagesSame(s2iDockBldr, custBldr, "FORCE PULL TEST s2i false: ")
})
})
g.Context("\n FORCE PULL TEST: when s2i force pull is true and the image is bad", func() {
g.It("\n FORCE PULL TEST s2i true", func() {
fpTrueS2I := exutil.FixturePath("fixtures", "forcepull-true-s2i.json")
g.By(fmt.Sprintf("\n%s FORCE PULL TEST s2i true: calling create on %s", time.Now().Format(time.RFC850), fpTrueS2I))
exutil.StartBuild(fpTrueS2I, buildPrefix, oc)
示例5:
var hostPort string
g.BeforeEach(func() {
g.By("set up policy for jenkins jobs")
err := oc.Run("policy").Args("add-role-to-user", "edit", "system:serviceaccount:"+oc.Namespace()+":default").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("kick off the build for the jenkins ephermeral and application templates")
tag := []string{"openshift/jenkins-plugin-snapshot-test:latest"}
hexIDs, err := exutil.DumpAndReturnTagging(tag)
var jenkinsEphemeralPath string
var testingSnapshot bool
if len(hexIDs) > 0 && err == nil {
// found an openshift pipeline plugin test image, must be testing a proposed change to the plugin
jenkinsEphemeralPath = exutil.FixturePath("fixtures", "jenkins-ephemeral-template-test-new-plugin.json")
testingSnapshot = true
} else {
// no test image, testing the base jenkins image with the current, supported version of the plugin
jenkinsEphemeralPath = exutil.FixturePath("..", "..", "examples", "jenkins", "jenkins-ephemeral-template.json")
}
err = oc.Run("new-app").Args(jenkinsEphemeralPath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
jenkinsApplicationPath := exutil.FixturePath("..", "..", "examples", "jenkins", "application-template.json")
err = oc.Run("new-app").Args(jenkinsApplicationPath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for jenkins deployment")
err = exutil.WaitForADeploymentToComplete(oc.KubeREST().ReplicationControllers(oc.Namespace()), "jenkins")
if err != nil {
exutil.DumpDeploymentLogs("jenkins", oc)
示例6:
import (
"path/filepath"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
buildapi "github.com/openshift/origin/pkg/build/api"
exutil "github.com/openshift/origin/test/extended/util"
kapi "k8s.io/kubernetes/pkg/api"
)
var _ = g.Describe("[builds] can use build secrets", func() {
defer g.GinkgoRecover()
var (
buildSecretBaseDir = exutil.FixturePath("fixtures", "build-secrets")
secretsFixture = filepath.Join(buildSecretBaseDir, "test-secret.json")
secondSecretsFixture = filepath.Join(buildSecretBaseDir, "test-secret-2.json")
isFixture = filepath.Join(buildSecretBaseDir, "test-is.json")
dockerBuildFixture = filepath.Join(buildSecretBaseDir, "test-docker-build.json")
sourceBuildFixture = filepath.Join(buildSecretBaseDir, "test-sti-build.json")
oc = exutil.NewCLI("build-secrets", exutil.KubeConfigPath())
)
g.Describe("build with secrets", func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
g.It("should print the secrets during the source strategy build", func() {
g.By("creating the sample secret files")
err := oc.Run("create").Args("-f", secretsFixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
示例7:
package builds
import (
"time"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[builds][Slow] build can have Docker image source", func() {
defer g.GinkgoRecover()
var (
buildFixture = exutil.FixturePath("testdata", "test-imagesource-build.yaml")
oc = exutil.NewCLI("build-image-source", exutil.KubeConfigPath())
imageSourceLabel = exutil.ParseLabelsOrDie("app=imagesourceapp")
imageDockerLabel = exutil.ParseLabelsOrDie("app=imagedockerapp")
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for imagestreams to be imported")
err = exutil.WaitForAnImageStream(oc.AdminREST().ImageStreams("openshift"), "jenkins", exutil.CheckImageStreamLatestTagPopulatedFn, exutil.CheckImageStreamTagNotFoundFn)
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("build with image source", func() {
示例8:
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[builds][Slow] using build configuration runPolicy", func() {
defer g.GinkgoRecover()
var (
// Use invalid source here as we don't care about the result
oc = exutil.NewCLI("cli-build-run-policy", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
// Create all fixtures
oc.Run("create").Args("-f", exutil.FixturePath("testdata", "run_policy")).Execute()
})
g.Describe("build configuration with Parallel build run policy", func() {
g.It("runs the builds in parallel", func() {
g.By("starting multiple builds")
var (
startedBuilds []string
counter int
)
bcName := "sample-parallel-build"
buildWatch, err := oc.Client().Builds(oc.Namespace()).Watch(kapi.ListOptions{
LabelSelector: buildutil.BuildConfigSelector(bcName),
})
defer buildWatch.Stop()
示例9:
"time"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
"github.com/openshift/origin/test/extended/util/db"
testutil "github.com/openshift/origin/test/util"
kapi "k8s.io/kubernetes/pkg/api"
kclient "k8s.io/kubernetes/pkg/client/unversioned"
)
var (
postgreSQLReplicationTemplate = "https://raw.githubusercontent.com/openshift/postgresql/master/examples/replica/postgresql_replica.json"
postgreSQLEphemeralTemplate = exutil.FixturePath("..", "..", "examples", "db-templates", "postgresql-ephemeral-template.json")
postgreSQLHelperName = "postgresql-helper"
postgreSQLImages = []string{
"openshift/postgresql-92-centos7",
"centos/postgresql-94-centos7",
"registry.access.redhat.com/openshift3/postgresql-92-rhel7",
"registry.access.redhat.com/rhscl/postgresql-94-rhel7",
}
)
var _ = g.Describe("[LocalNode][images][postgresql][Slow] openshift postgresql replication", func() {
defer g.GinkgoRecover()
for i, image := range postgreSQLImages {
oc := exutil.NewCLI(fmt.Sprintf("postgresql-replication-%d", i), exutil.KubeConfigPath())
testFn := PostgreSQLReplicationTestFactory(oc, image)
示例10:
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[builds][pullsecret][Conformance] docker build using a pull secret", func() {
defer g.GinkgoRecover()
const (
buildTestPod = "build-test-pod"
buildTestService = "build-test-svc"
)
var (
buildFixture = exutil.FixturePath("testdata", "test-docker-build-pullsecret.json")
oc = exutil.NewCLI("docker-build-pullsecret", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.AdminKubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("Building from a template", func() {
g.It("should create a docker build that pulls using a secret run it", func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
g.By(fmt.Sprintf("calling oc create -f %q", buildFixture))
err := oc.Run("create").Args("-f", buildFixture).Execute()
示例11:
o "github.com/onsi/gomega"
e2e "k8s.io/kubernetes/test/e2e/framework"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[builds][Slow] incremental s2i build", func() {
defer g.GinkgoRecover()
const (
buildTestPod = "build-test-pod"
buildTestService = "build-test-svc"
)
var (
templateFixture = exutil.FixturePath("testdata", "incremental-auth-build.json")
podAndServiceFixture = exutil.FixturePath("testdata", "test-build-podsvc.json")
oc = exutil.NewCLI("build-sti-inc", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.AdminKubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("Building from a template", func() {
g.It(fmt.Sprintf("should create a build from %q template and run it", templateFixture), func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
g.By(fmt.Sprintf("calling oc new-app -f %q", templateFixture))
示例12:
package builds
import (
kapi "k8s.io/kubernetes/pkg/api"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
buildapi "github.com/openshift/origin/pkg/build/api"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[builds][Slow] builds should have deadlines", func() {
defer g.GinkgoRecover()
var (
sourceFixture = exutil.FixturePath("testdata", "test-cds-sourcebuild.json")
dockerFixture = exutil.FixturePath("testdata", "test-cds-dockerbuild.json")
oc = exutil.NewCLI("cli-start-build", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("oc start-build source-build --wait", func() {
g.It("Source: should start a build and wait for the build failed and build pod being killed by kubelet", func() {
g.By("calling oc create source-build")
err := oc.Run("create").Args("-f", sourceFixture).Execute()
示例13:
"fmt"
"path/filepath"
"strings"
"k8s.io/kubernetes/test/e2e"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("builds: parallel: STI build with .sti/environment file", func() {
defer g.GinkgoRecover()
var (
imageStreamFixture = exutil.FixturePath("..", "integration", "fixtures", "test-image-stream.json")
stiEnvBuildFixture = exutil.FixturePath("fixtures", "test-env-build.json")
oc = exutil.NewCLI("build-sti-env", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("Building from a template", func() {
g.It(fmt.Sprintf("should create a image from %q template and run it in a pod", stiEnvBuildFixture), func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
g.By(fmt.Sprintf("calling oc create -f %q", imageStreamFixture))
示例14:
"strings"
"time"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
"k8s.io/kubernetes/pkg/util/wait"
e2e "k8s.io/kubernetes/test/e2e/framework"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[networking][router] weighted openshift router", func() {
defer g.GinkgoRecover()
var (
configPath = exutil.FixturePath("testdata", "weighted-router.yaml")
oc = exutil.NewCLI("weighted-router", exutil.KubeConfigPath())
)
g.BeforeEach(func() {
// defer oc.Run("delete").Args("-f", configPath).Execute()
err := oc.AsAdmin().Run("adm").Args("policy", "add-cluster-role-to-user", "system:router", oc.Username()).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("create").Args("-f", configPath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("The HAProxy router", func() {
g.It("should appropriately serve a route that points to two services", func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
示例15:
import (
kapi "k8s.io/kubernetes/pkg/api"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
buildapi "github.com/openshift/origin/pkg/build/api"
buildutil "github.com/openshift/origin/pkg/build/util"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("builds: build with CompletionDeadlineSeconds", func() {
defer g.GinkgoRecover()
var (
sourceFixture = exutil.FixturePath("..", "extended", "fixtures", "test-cds-sourcebuild.json")
dockerFixture = exutil.FixturePath("..", "extended", "fixtures", "test-cds-dockerbuild.json")
oc = exutil.NewCLI("cli-start-build", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("oc start-build source-build --wait", func() {
g.It("Source: should start a build and wait for the build failed and build pod being killed by kubelet", func() {
g.By("calling oc create source-build")
err := oc.Run("create").Args("-f", sourceFixture).Execute()