forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarketplace_diffname.go
88 lines (73 loc) · 3.48 KB
/
marketplace_diffname.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package marketplace
import (
"fmt"
"strings"
"time"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
"k8s.io/apimachinery/pkg/util/wait"
e2e "k8s.io/kubernetes/test/e2e/framework"
)
var _ = g.Describe("[sig-operator][Feature:Marketplace] Marketplace diff name test", func() {
defer g.GinkgoRecover()
var (
oc = exutil.NewCLI("marketplace")
allNs = "openshift-operators"
marketplaceNs = "openshift-marketplace"
resourceWait = 60 * time.Second
opsrcYamltem = exutil.FixturePath("testdata", "marketplace", "opsrc", "02-opsrc.yaml")
cscYamltem = exutil.FixturePath("testdata", "marketplace", "csc", "02-csc.yaml")
)
g.AfterEach(func() {
// Clear the resource
allresourcelist := [][]string{
{"operatorsource", "samename", marketplaceNs},
{"catalogsourceconfig", "samename", marketplaceNs},
}
for _, source := range allresourcelist {
err := clearResources(oc, source[0], source[1], source[2])
o.Expect(err).NotTo(o.HaveOccurred())
}
})
//OCP-25672 create a opsrc named "samename", then create a csc also named "samename"
g.It("[ocp-25672] create the samename opsrc&csc [Serial]", func() {
// Create one opsrc samename
opsrcYaml, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", opsrcYamltem, "-p", "NAME=samename", "NAMESPACE=marketplace_e2e", "LABEL=samename", "DISPLAYNAME=samename", "PUBLISHER=samename", fmt.Sprintf("MARKETPLACE=%s", marketplaceNs)).OutputToFile("config.json")
o.Expect(err).NotTo(o.HaveOccurred())
err = createResources(oc, opsrcYaml)
o.Expect(err).NotTo(o.HaveOccurred())
// Wait for the opsrc is created finished
err = wait.Poll(5*time.Second, resourceWait, func() (bool, error) {
output, err := oc.AsAdmin().Run("get").Args("operatorsource", "samename", "-o=jsonpath={.status.currentPhase.phase.message}", "-n", marketplaceNs).Output()
if err != nil {
e2e.Failf("Failed to create samename, error:%v", err)
return false, err
}
if strings.Contains(output, "has been successfully reconciled") {
return true, nil
}
return false, nil
})
o.Expect(err).NotTo(o.HaveOccurred())
opsrcResourceList := [][]string{
{"operatorsource", "samename", marketplaceNs},
{"deployment", "samename", marketplaceNs},
{"catalogsource", "samename", marketplaceNs},
{"service", "samename", marketplaceNs},
}
for _, source := range opsrcResourceList {
msg, _ := existResources(oc, source[0], source[1], source[2])
o.Expect(msg).Should(o.BeTrue())
}
// Create the csc samename
cscYaml, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", cscYamltem, "-p", "NAME=samename", fmt.Sprintf("NAMESPACE=%s", allNs), fmt.Sprintf("MARKETPLACE=%s", marketplaceNs), "PACKAGES=camel-k-marketplace-e2e-tests", "DISPLAYNAME=samename", "PUBLISHER=samename").OutputToFile("config.json")
err = createResources(oc, cscYaml)
o.Expect(err).NotTo(o.HaveOccurred())
// Check the csc status
outMesg, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsourceconfig", "samename", "-o=jsonpath={.status.currentPhase.phase.message}", "-n", marketplaceNs).Output()
o.Expect(outMesg).Should(o.ContainSubstring("Deployment samename exists"))
outStatus, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsourceconfig", "samename", "-o=jsonpath={.status.currentPhase.phase.name}", "-n", marketplaceNs).Output()
o.Expect(outStatus).Should(o.ContainSubstring("Configuring"))
})
})