Skip to content

Commit

Permalink
[artemiscloud#692] Add test-mk-do-fast-v to ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
brusdev committed Sep 25, 2023
1 parent c34b95f commit 4b14047
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 16 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,38 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: '1.19.8'
cache: true

- name: Checkout the repo
uses: actions/checkout@v2

- name: Start minikube
id: minikube
uses: medyagh/setup-minikube@master
with:
cpus: 2
memory: 4g

- name: Check generate files
run: make generate-deploy && make bundle && git status && git diff-index --quiet HEAD --

- name: Build the image
run: |
podman build --build-arg TARGETOS=linux --build-arg TARGETARCH=amd64 --label quay.expires-after=90d --label git-sha=$GITHUB_SHA --no-cache --platform linux/amd64 --manifest $IMAGE_NAME:dev.latest .
- name: Push the image into minikube
run: |
export SHELL=/bin/bash
eval $(minikube -p minikube docker-env)
docker image list
export OPERATOR_IMAGE=$(grep -Po '(?<=image: ).*' ./deploy/operator.yaml)
podman tag $IMAGE_NAME:dev.latest $OPERATOR_IMAGE
podman save --output activemq-artemis-operator-image.tar --format docker-archive $OPERATOR_IMAGE
docker image load --input activemq-artemis-operator-image.tar
docker image list
- name: Execute the tests
run: make test
run: make test-mk-do-fast-v

- name: Set up Node.js
uses: actions/setup-node@v2
Expand All @@ -49,12 +72,13 @@ jobs:
npm install && npm run build
- name: Set up QEMU
if: ${{ github.event_name == 'push' }}
uses: docker/setup-qemu-action@v1

- name: Build the image
- name: Build the image for arm64
if: ${{ github.event_name == 'push' }}
run: |
podman build --build-arg TARGETOS=linux --build-arg TARGETARCH=amd64 --label quay.expires-after=90d --label git-sha=$GITHUB_SHA --no-cache --platform linux/amd64 --manifest $IMAGE_NAME:dev.latest .
#podman build --build-arg TARGETOS=linux --build-arg TARGETARCH=arm64 --label quay.expires-after=90d --label git-sha=$GITHUB_SHA --no-cache --platform linux/arm64 --manifest $IMAGE_NAME:dev.latest .
podman build --build-arg TARGETOS=linux --build-arg TARGETARCH=arm64 --label quay.expires-after=90d --label git-sha=$GITHUB_SHA --no-cache --platform linux/arm64 --manifest $IMAGE_NAME:dev.latest .
- name: Push the dev image
if: ${{ github.event_name == 'push' }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ test-mk-do-fast test-mk-do-fast-v: TEST_ARGS += -test.timeout=40m -ginkgo.label-
test-mk-do-fast test-mk-do-fast-v: TEST_VARS = DEPLOY_OPERATOR=true ENABLE_WEBHOOKS=false USE_EXISTING_CLUSTER=true

test-v test-mk-v test-mk-do-v test-mk-do-fast-v: TEST_ARGS += -v
test-v test-mk test-mk-v test-mk-do test-mk-do-v test-mk-do-fast test-mk-do-fast-v: TEST_ARGS += -ginkgo.slow-spec-threshold=30s -ginkgo.fail-fast -coverprofile cover-mk.out
test-v test-mk test-mk-v test-mk-do test-mk-do-v test-mk-do-fast test-mk-do-fast-v: TEST_ARGS += -ginkgo.poll-progress-after=30s -ginkgo.fail-fast -coverprofile cover-mk.out

test test-v test-mk test-mk-v test-mk-do test-mk-do-v test-mk-do-fast test-mk-do-fast-v: manifests generate fmt vet envtest
$(TEST_VARS) go test ./... -p 1 $(TEST_ARGS) $(TEST_EXTRA_ARGS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ var _ = Describe("artemis controller", Label("do"), func() {
BeforeEachSpec()
})

AfterEach(func() {
AfterEachSpec()
})

Context("tls jolokia access", Label("do-secure-console-with-sni"), func() {
It("check the util works in test env", func() {
domainName := common.GetClusterDomain()
Expand Down
2 changes: 2 additions & 0 deletions controllers/activemqartemis_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ var _ = Describe("artemis controller", func() {
for e := wis.Front(); e != nil; e = e.Next() {
e.Value.(watch.Interface).Stop()
}

AfterEachSpec()
})

Context("tls secret reuse", Label("tls-secret-reuse"), func() {
Expand Down
4 changes: 4 additions & 0 deletions controllers/activemqartemis_pub_sub_scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ var _ = Describe("pub sub scale", func() {
BeforeEachSpec()
})

AfterEach(func() {
AfterEachSpec()
})

Context("pub n sub, ha pub, partitioned sub", Label("slow"), func() {
It("validation", func() {
if os.Getenv("USE_EXISTING_CLUSTER") == "true" {
Expand Down
4 changes: 4 additions & 0 deletions controllers/activemqartemis_scale_zero_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ var _ = Describe("subresource scale down", func() {
BeforeEachSpec()
})

AfterEach(func() {
AfterEachSpec()
})

Context("scale to zero via scale subresource", func() {
It("deploy plan 1", func() {
if os.Getenv("USE_EXISTING_CLUSTER") == "true" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ var _ = Describe("Address controller DO", Label("do"), func() {
BeforeEachSpec()
})

AfterEach(func() {
AfterEachSpec()
})

Context("Address test", func() {

It("Deploy CR with size 5 (pods)", Label("slow"), func() {
Expand Down
4 changes: 4 additions & 0 deletions controllers/activemqartemisaddress_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ var _ = Describe("Address controller tests", func() {
BeforeEachSpec()
})

AfterEach(func() {
AfterEachSpec()
})

Context("address queue config defaults", Label("queue-config-defaults"), func() {
if os.Getenv("USE_EXISTING_CLUSTER") == "true" {
queueName := "myqueue"
Expand Down
4 changes: 4 additions & 0 deletions controllers/activemqartemisscaledown_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ var _ = Describe("Scale down controller", func() {
BeforeEachSpec()
})

AfterEach(func() {
AfterEachSpec()
})

Context("Scale down test", func() {
It("deploy plan 2 clustered", Label("basic-scaledown-check"), func() {

Expand Down
1 change: 1 addition & 0 deletions controllers/activemqartemissecurity_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var _ = Describe("security controller", func() {
})

AfterEach(func() {
AfterEachSpec()
})

Context("broker with security custom resources", Label("broker-security-res"), func() {
Expand Down
27 changes: 22 additions & 5 deletions controllers/common_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ func newArtemisSpecWithFastProbes() brokerv1beta1.ActiveMQArtemisSpec {
spec := brokerv1beta1.ActiveMQArtemisSpec{}

// sensible fast defaults for tests against existing cluster
spec.DeploymentPlan.LivenessProbe = &corev1.Probe{
InitialDelaySeconds: 1,
PeriodSeconds: 2,
}
spec.DeploymentPlan.ReadinessProbe = &corev1.Probe{
InitialDelaySeconds: 1,
PeriodSeconds: 2,
PeriodSeconds: 3,
}
spec.DeploymentPlan.LivenessProbe = &corev1.Probe{
InitialDelaySeconds: 6,
PeriodSeconds: 3,
}

return spec
Expand Down Expand Up @@ -436,6 +436,23 @@ func RunCommandInPod(podName string, containerName string, command []string) (*s
return &content, nil
}

func EventsOfPod(podWithOrdinal string, namespace string, g Gomega) *corev1.EventList {

cfg, err := config.GetConfig()
g.Expect(err).To(BeNil())

clientset, err := kubernetes.NewForConfig(cfg)
g.Expect(err).To(BeNil())

events, err := clientset.CoreV1().Events(namespace).List(context.TODO(), metav1.ListOptions{
FieldSelector: "involvedObject.name=" + podWithOrdinal,
TypeMeta: metav1.TypeMeta{Kind: "Pod"},
})
g.Expect(err).To(BeNil())

return events
}

func LogsOfPod(podWithOrdinal string, brokerName string, namespace string, g Gomega) string {

gvk := schema.GroupVersionKind{
Expand Down
4 changes: 4 additions & 0 deletions controllers/controllermanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ var _ = Describe("tests regarding controller manager", func() {
BeforeEachSpec()
})

AfterEach(func() {
AfterEachSpec()
})

Context("operator namespaces test", func() {

It("test resolving watching namespace", func() {
Expand Down
17 changes: 11 additions & 6 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,15 @@ func BeforeEachSpec() {
specCount++

//Print running spec
fmt.Println("\n\033[32mRunning Spec " +
strconv.FormatInt(specCount, 10) + ": " +
CurrentSpecReport().FullText() + " " +
"\033[33m[" + CurrentSpecShortName() + "]\033[0m\n" +
CurrentSpecReport().LeafNodeLocation.FileName + ":" +
strconv.Itoa(CurrentSpecReport().LeafNodeLocation.LineNumber))
currentSpecReport := CurrentSpecReport()
fmt.Printf("\n\033[1m\033[32mSpec %d running: %s \033[33m[%s]\033[0m\n%s:%d",
specCount, currentSpecReport.FullText(), CurrentSpecShortName(),
currentSpecReport.LeafNodeLocation.FileName, currentSpecReport.LeafNodeLocation.LineNumber)
}

func AfterEachSpec() {
//Print ran spec
currentSpecReport := CurrentSpecReport()
fmt.Printf("\n\033[1m\033[32mSpec %d ran in %f seconds \033[0m\n",
specCount, currentSpecReport.RunTime.Seconds())
}

0 comments on commit 4b14047

Please sign in to comment.