Skip to content

Commit

Permalink
Fix test failure caused by change in production slug
Browse files Browse the repository at this point in the history
Also remove the GitHub actions, which had not fully materialized

Signed-off-by: Pete Wall <pwall@vmware.com>
  • Loading branch information
Pete Wall committed Jun 21, 2022
1 parent 768315a commit 57e214e
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 225 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/release.yml

This file was deleted.

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ else
MKPCLI_STRICT_DECODING=true ginkgo -r test/external
endif

test-external-scripts:
cd test-scripts && ./external-test-runner.sh

test: deps lint test-units test-features test-external test-external-with-strict-decoding

test-all: test test-external-scripts
lint: lint-go lint-bash

lint: deps-golangci-lint deps-shellcheck
lint-go: deps-golangci-lint
golangci-lint run
shellcheck test-scripts/*.sh

BASH_SRC = $(shell find . -name "*.sh" )
lint-bash: $(BASH_SRC) deps-shellcheck
shellcheck $(BASH_SRC)

# #### DEVOPS ####
.PHONY: set-pipeline
Expand Down
29 changes: 0 additions & 29 deletions action.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ci/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ jobs:
params:
MARKETPLACE_ENV: production
ASSET_TYPE: image
PRODUCT_SLUG: vmware-tanzu-rabbitmq1
PRODUCT_SLUG: datastax-kubernetes-operator-for-apache-cassandra
PRODUCT_VERSION: "1.0.0"
on_error:
put: slack
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ci/tasks/download-asset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ inputs:
- name: source

run:
path: source/test-scripts/download-asset.sh
path: source/ci/tasks/download-asset.sh
74 changes: 0 additions & 74 deletions entrypoint.sh

This file was deleted.

20 changes: 0 additions & 20 deletions test-scripts/external-test-inputs.json

This file was deleted.

41 changes: 0 additions & 41 deletions test-scripts/external-test-runner.sh

This file was deleted.

16 changes: 14 additions & 2 deletions test/common_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ func unsetEnvVars(envVars []string, varsToUnset []string) []string {

func DefineCommonSteps(define Definitions) {
var (
envVars []string
unsetVars []string
envVars []string
unsetVars []string
downloadedFile string
)

define.Given(`^targeting the (.*) environment$`, func(environment string) {
Expand Down Expand Up @@ -92,4 +93,15 @@ func DefineCommonSteps(define Definitions) {
value := gjson.Get(configOutput, keyPath)
Expect(value.String()).To(Equal(expectedValue))
})

define.Then(`^(.*) is downloaded$`, func(filename string) {
downloadedFile = filename
_, err := os.Stat(filename)
Expect(err).ToNot(HaveOccurred())
}, func() {
if downloadedFile != "" {
Expect(os.Remove(downloadedFile)).To(Succeed())
downloadedFile = ""
}
})
}
32 changes: 16 additions & 16 deletions test/external/debugging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,47 @@ var _ = Describe("Debugging", func() {

Scenario("Debugging enabled", func() {
steps.Given("targeting the production environment")
steps.When("running mkpcli --debug product get --product vmware-tanzu-rabbitmq1")
steps.When("running mkpcli --debug product get --product nginx")
steps.Then("the command exits without error")
steps.And("the request is printed")
})

Scenario("Debugging enabled with environment variable", func() {
steps.Given("targeting the production environment")
steps.And("the environment variable MKPCLI_DEBUG is set to true")
steps.When("running mkpcli product get --product vmware-tanzu-rabbitmq1")
steps.When("running mkpcli product get --product nginx")
steps.Then("the command exits without error")
steps.And("the request is printed")
})

Scenario("Debugging enabled with request payloads", func() {
steps.Given("targeting the production environment")
steps.When("running mkpcli --debug --debug-request-payloads download -p vmware-tanzu-rabbitmq1 -v 1.0.0 --accept-eula")
steps.When("running mkpcli --debug --debug-request-payloads download -p nginx -v 1.22.0_150_r04 --filename chart.tgz --accept-eula")
steps.Then("the command exits without error")
steps.And("the container image is downloaded")
steps.And("chart.tgz is downloaded")
steps.And("the requests are printed with request payloads")
})

Scenario("Debugging enabled with request payloads with environment variables", func() {
steps.Given("targeting the production environment")
steps.And("the environment variable MKPCLI_DEBUG is set to true")
steps.And("the environment variable MKPCLI_DEBUG_REQUEST_PAYLOADS is set to true")
steps.When("running mkpcli download -p vmware-tanzu-rabbitmq1 -v 1.0.0 --accept-eula")
steps.When("running mkpcli download -p nginx -v 1.22.0_150_r04 --filename chart.tgz --accept-eula")
steps.Then("the command exits without error")
steps.And("the container image is downloaded")
steps.And("chart.tgz is downloaded")
steps.And("the requests are printed with request payloads")
})

steps.Define(func(define Definitions) {
DefineCommonSteps(define)

define.Then(`^the request is printed$`, func() {
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #0: GET https://gtw.marketplace.cloud.vmware.com/api/v1/products/vmware-tanzu-rabbitmq1?increaseViewCount=false&isSlug=true")))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #0: GET https://gtw.marketplace.cloud.vmware.com/api/v1/products/nginx?increaseViewCount=false&isSlug=true")))
Eventually(CommandSession.Err).Should(Say("Request #0 Response: 200 OK"))
Eventually(CommandSession.Out).Should(Say("Name: VMware Tanzu RabbitMQ"))
Eventually(CommandSession.Out).Should(Say("Publisher: VMware Inc"))
Eventually(CommandSession.Out).Should(Say("Assets for 1.0.0:"))
Eventually(CommandSession.Out).Should(Say("registry.pivotal.io/rabbitmq/vmware-tanzu-rabbitmq:2020.12"))
Eventually(CommandSession.Out).Should(Say("Name: NGINX Open Source Helm Chart packaged by Bitnami"))
Eventually(CommandSession.Out).Should(Say("Publisher: Bitnami"))
Eventually(CommandSession.Out).Should(Say("Assets for 1.22.0_150_r04:"))
Eventually(CommandSession.Out).Should(Say("https://charts.bitnami.com/bitnami/nginx-12.0.4.tgz"))
})

define.Then(`^the container image is downloaded$`, func() {
Expand All @@ -68,16 +68,16 @@ var _ = Describe("Debugging", func() {
})

define.Then(`^the requests are printed with request payloads$`, func() {
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #0: GET https://gtw.marketplace.cloud.vmware.com/api/v1/products/vmware-tanzu-rabbitmq1?increaseViewCount=false&isSlug=true")))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #0: GET https://gtw.marketplace.cloud.vmware.com/api/v1/products/nginx?increaseViewCount=false&isSlug=true")))
Eventually(CommandSession.Err).Should(Say("Request #0 Response: 200 OK"))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #1: POST https://gtw.marketplace.cloud.vmware.com/api/v1/products/5f99a9d5-dbfd-4cfc-a564-b1a67d092b4f/version-details?versionNumber=1.0.0")))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #1: POST https://gtw.marketplace.cloud.vmware.com/api/v1/products/89431c5d-ddb7-45df-a544-2c81a370e17b/version-details?versionNumber=1.22.0_150_r04")))
Eventually(CommandSession.Err).Should(Say("Request #1 Response: 200 OK"))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #2: POST https://gtw.marketplace.cloud.vmware.com/api/v1/products/5f99a9d5-dbfd-4cfc-a564-b1a67d092b4f/download")))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #2: POST https://gtw.marketplace.cloud.vmware.com/api/v1/products/89431c5d-ddb7-45df-a544-2c81a370e17b/download")))
Eventually(CommandSession.Err).Should(Say("--- Start of request #2 body payload ---"))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("{\"productid\":\"5f99a9d5-dbfd-4cfc-a564-b1a67d092b4f\",\"appVersion\":\"1.0.0\",\"eulaAccepted\":true,\"dockerlinkVersionId\":\"d333021c-6e7d-4a15-b87a-2f66eda9d30c\",\"dockerUrlId\":\"f1702bcd-5634-4983-a652-653b6aedbe1d\",\"imageTagId\":\"83fa36ea-4ebc-4499-b68d-b95bc185dd65\"}")))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("{\"productid\":\"89431c5d-ddb7-45df-a544-2c81a370e17b\",\"appVersion\":\"1.22.0_150_r04\",\"eulaAccepted\":true,\"chartVersion\":\"12.0.4\"}")))
Eventually(CommandSession.Err).Should(Say("--- End of request #2 body payload ---"))
Eventually(CommandSession.Err).Should(Say("Request #2 Response: 200 OK"))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #3: GET https://cmpprdcontainersolutions.s3.us-west-2.amazonaws.com/containerImageTars/")))
Eventually(CommandSession.Err).Should(Say(regexp.QuoteMeta("Request #3: GET https://cmpprdhelmsolutions.s3.us-west-2.amazonaws.com/marketplace-product-files/89431c5d-ddb7-45df-a544-2c81a370e17b/")))
Eventually(CommandSession.Err).Should(Say("Request #3 Response: 200 OK"))
})
})
Expand Down
9 changes: 0 additions & 9 deletions test/external/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
package external_test

import (
"os"

. "github.com/bunniesandbeatings/goerkin"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -38,13 +36,6 @@ var _ = Describe("Download", func() {
steps.Define(func(define Definitions) {
DefineCommonSteps(define)

define.Then(`^yq is downloaded$`, func() {
_, err := os.Stat("yq")
Expect(err).ToNot(HaveOccurred())
}, func() {
_ = os.Remove("yq")
})

define.Then(`^a message saying that there are multiple assets available to download$`, func() {
Eventually(CommandSession.Err).Should(Say("product " + ProductSlug + " " + ProductVersion + " has multiple downloadable assets, please use the --filter parameter"))
})
Expand Down

0 comments on commit 57e214e

Please sign in to comment.