Skip to content

Commit 578ce23

Browse files
committed
fix after comments
Signed-off-by: Flavius Lacatusu <flacatus@redhat.com>
1 parent 880ac53 commit 578ce23

File tree

5 files changed

+28
-22
lines changed

5 files changed

+28
-22
lines changed

tests/check_rhtap_nightly.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
5+
samplesFile="$(pwd)/extraDevfileEntries.yaml"
6+
7+
ginkgo run --procs 2 \
8+
--timeout 2h \
9+
tests/rhtap -- -samplesFile "$samplesFile"

tests/rhtap/check_nightly.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/rhtap/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ go 1.18
55
require (
66
github.com/onsi/ginkgo/v2 v2.9.2
77
github.com/onsi/gomega v1.27.6
8+
github.com/redhat-appstudio/application-api v0.0.0-20230509152222-ef5c4dcebc94
89
github.com/redhat-appstudio/e2e-tests v0.0.0-20230628083559-110126807738
10+
gopkg.in/yaml.v2 v2.4.0
911
)
1012

1113
replace (
@@ -127,7 +129,6 @@ require (
127129
github.com/prometheus/common v0.42.0 // indirect
128130
github.com/prometheus/procfs v0.9.0 // indirect
129131
github.com/prometheus/statsd_exporter v0.23.0 // indirect
130-
github.com/redhat-appstudio/application-api v0.0.0-20230509152222-ef5c4dcebc94 // indirect
131132
github.com/redhat-appstudio/build-service v0.0.0-20230113121706-a9f10055dbc4 // indirect
132133
github.com/redhat-appstudio/image-controller v0.0.0-20230606065013-5c7c65e0db05 // indirect
133134
github.com/redhat-appstudio/integration-service v0.0.0-20230427084439-306b4611389b // indirect
@@ -170,7 +171,6 @@ require (
170171
google.golang.org/grpc v1.54.0 // indirect
171172
google.golang.org/protobuf v1.30.0 // indirect
172173
gopkg.in/inf.v0 v0.9.1 // indirect
173-
gopkg.in/yaml.v2 v2.4.0 // indirect
174174
gopkg.in/yaml.v3 v3.0.1 // indirect
175175
k8s.io/api v0.27.0 // indirect
176176
k8s.io/apiextensions-apiserver v0.27.0 // indirect

tests/rhtap/rhtap_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import (
1414
"github.com/redhat-appstudio/e2e-tests/pkg/utils"
1515
)
1616

17-
var stacksPath string
17+
var samplesFile string
1818
var namespace string
1919

2020
func init() {
2121
rand.Seed(time.Now().UnixNano())
22-
flag.StringVar(&stacksPath, "stacksPath", "../../extraDevfileEntries.yaml", "Parent stack file")
22+
flag.StringVar(&samplesFile, "samplesFile", "../../extraDevfileEntries.yaml", "Parent stack file")
2323
flag.StringVar(&namespace, "namespace", "", "Namespace where create and build stack samples")
2424
}
2525

@@ -30,19 +30,19 @@ func TestRhtap(t *testing.T) {
3030

3131
}
3232

33-
var _ = Describe("RHTAP parent stacks checks", Ordered, Label("nightly"), func() {
33+
var _ = Describe("RHTAP sample checks", Ordered, Label("nightly"), func() {
3434
var fw *testHub.ControllerHub
3535
var testNamespace string
3636
component := &appservice.Component{}
3737
cdq := &appservice.ComponentDetectionQuery{}
3838

39-
stacks, err := LoadTestGeneratorConfig(stacksPath)
39+
entries, err := LoadExtraDevfileEntries(samplesFile)
4040
Expect(err).NotTo(HaveOccurred())
4141

42-
for _, stack := range stacks.Samples {
43-
stack := stack
42+
for _, sampleEntry := range entries.Samples {
43+
sampleEntry := sampleEntry
4444

45-
Describe(stack.Name, func() {
45+
Describe(sampleEntry.Name, func() {
4646
BeforeAll(func() {
4747
kubeClient, err := e2eKube.NewAdminKubernetesClient()
4848
Expect(err).NotTo(HaveOccurred())
@@ -68,29 +68,29 @@ var _ = Describe("RHTAP parent stacks checks", Ordered, Label("nightly"), func()
6868
// Create an application in a specific namespace
6969
It("creates an application", func() {
7070
GinkgoWriter.Printf("Parallel process %d\n", GinkgoParallelProcess())
71-
createdApplication, err := fw.HasController.CreateApplication(stack.Name, testNamespace)
71+
createdApplication, err := fw.HasController.CreateApplication(sampleEntry.Name, testNamespace)
7272
Expect(err).NotTo(HaveOccurred())
7373
Expect(createdApplication.Namespace).To(Equal(testNamespace))
7474
})
7575

7676
// Check the application health and check if a devfile was generated in the status
7777
It("checks if application is healthy", func() {
7878
Eventually(func() string {
79-
application, err := fw.HasController.GetApplication(stack.Name, testNamespace)
79+
application, err := fw.HasController.GetApplication(sampleEntry.Name, testNamespace)
8080
Expect(err).NotTo(HaveOccurred())
8181

8282
return application.Status.Devfile
8383
}, 3*time.Minute, 100*time.Millisecond).Should(Not(BeEmpty()), "Error creating gitOps repository")
8484
})
8585

8686
It("creates componentdetectionquery", func() {
87-
cdq, err = fw.HasController.CreateComponentDetectionQuery(stack.Name, testNamespace, stack.Git.Remotes.Origin, "", "", "", false)
87+
cdq, err = fw.HasController.CreateComponentDetectionQuery(sampleEntry.Name, testNamespace, sampleEntry.Git.Remotes.Origin, "", "", "", false)
8888
Expect(err).NotTo(HaveOccurred())
8989
})
9090

9191
It("creates component", func() {
9292
for _, compDetected := range cdq.Status.ComponentDetected {
93-
component, err = fw.HasController.CreateComponent(compDetected.ComponentStub, testNamespace, "", "", stack.Name, true, map[string]string{})
93+
component, err = fw.HasController.CreateComponent(compDetected.ComponentStub, testNamespace, "", "", sampleEntry.Name, true, map[string]string{})
9494
Expect(err).NotTo(HaveOccurred())
9595
}
9696
})

tests/rhtap/types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ type Git struct {
1515
Remotes Remotes `yaml:"remotes"`
1616
}
1717

18-
type Samples struct {
18+
type SampleEntry struct {
1919
Name string `yaml:"name"`
2020
DisplayName string `yaml:"displayName"`
2121
Language string `yaml:"language"`
2222
ProjectType string `yaml:"projectType"`
2323
Git Git `yaml:"git"`
2424
}
2525

26-
type Stacks struct {
27-
SchemaVersion string `yaml:"schemaVersion"`
28-
Samples []Samples `yaml:"samples"`
26+
type ExtraDevfileEntries struct {
27+
SchemaVersion string `yaml:"schemaVersion"`
28+
Samples []SampleEntry `yaml:"samples"`
2929
}
3030

31-
func LoadTestGeneratorConfig(configPath string) (Stacks, error) {
32-
s := Stacks{}
31+
func LoadExtraDevfileEntries(configPath string) (ExtraDevfileEntries, error) {
32+
s := ExtraDevfileEntries{}
3333
// Open config file
3434
file, err := os.Open(filepath.Clean(configPath))
3535
if err != nil {

0 commit comments

Comments
 (0)