Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
moved integration test metadata to yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Jun 18, 2018
1 parent 0d2774f commit cc2d4e8
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 24 deletions.
1 change: 0 additions & 1 deletion integration/basic-stateless/customer_id

This file was deleted.

1 change: 0 additions & 1 deletion integration/basic-stateless/installation_id

This file was deleted.

3 changes: 3 additions & 0 deletions integration/basic-stateless/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "RULNveQLrLj4GDum1yQhvKAcABh0GcLY"
release_version: "0.0.4"
1 change: 0 additions & 1 deletion integration/basic-stateless/release_version

This file was deleted.

1 change: 0 additions & 1 deletion integration/basic/customer_id

This file was deleted.

1 change: 0 additions & 1 deletion integration/basic/installation_id

This file was deleted.

3 changes: 3 additions & 0 deletions integration/basic/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "RULNveQLrLj4GDum1yQhvKAcABh0GcLY"
release_version: "0.0.4"
1 change: 0 additions & 1 deletion integration/basic/release_version

This file was deleted.

1 change: 0 additions & 1 deletion integration/docker/customer_id

This file was deleted.

1 change: 0 additions & 1 deletion integration/docker/installation_id

This file was deleted.

3 changes: 3 additions & 0 deletions integration/docker/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "RULNveQLrLj4GDum1yQhvKAcABh0GcLY"
release_version: "0.0.5"
1 change: 0 additions & 1 deletion integration/docker/release_version

This file was deleted.

29 changes: 14 additions & 15 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/replicatedhq/ship/pkg/cli"
"gopkg.in/yaml.v2"
)

type TestMetadata struct {
CustomerID string `yaml:"customer_id"`
InstallationID string `yaml:"installation_id"`
ReleaseVersion string `yaml:"release_version"`
}

func TestCore(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "integration")
Expand Down Expand Up @@ -92,8 +99,7 @@ var _ = Describe("basic", func() {
testPath := path.Join(integrationDir, file.Name())
testOutputPath := path.Join(testPath, "tmp")
testInputPath := path.Join(testPath, "input")

var customerID, installationID, releaseVersion string
var testMetadata TestMetadata

BeforeEach(func() {
// create a temporary directory within this directory to compare files with
Expand All @@ -102,18 +108,11 @@ var _ = Describe("basic", func() {
Expect(err).NotTo(HaveOccurred())
os.Chdir(testOutputPath)

// read the customer ID, installation ID and release version for this test
custIDBytes, err := ioutil.ReadFile(path.Join(testPath, "customer_id"))
// read the test metadata
metadataBytes, err := ioutil.ReadFile(path.Join(testPath, "metadata.yaml"))
Expect(err).NotTo(HaveOccurred())
customerID = string(custIDBytes)

installationIDBytes, err := ioutil.ReadFile(path.Join(testPath, "installation_id"))
Expect(err).NotTo(HaveOccurred())
installationID = string(installationIDBytes)

releaseVersionBytes, err := ioutil.ReadFile(path.Join(testPath, "release_version"))
err = yaml.Unmarshal(metadataBytes, &testMetadata)
Expect(err).NotTo(HaveOccurred())
releaseVersion = string(releaseVersionBytes)
})

AfterEach(func() {
Expand Down Expand Up @@ -152,9 +151,9 @@ var _ = Describe("basic", func() {
fmt.Sprintf("--state-file=%s", path.Join(testInputPath, ".ship/state.json")),
"--customer-endpoint=https://pg.staging.replicated.com/graphql",
"--log-level=off",
fmt.Sprintf("--customer-id=%s", customerID),
fmt.Sprintf("--installation-id=%s", installationID),
fmt.Sprintf("--release-semver=%s", releaseVersion),
fmt.Sprintf("--customer-id=%s", testMetadata.CustomerID),
fmt.Sprintf("--installation-id=%s", testMetadata.InstallationID),
fmt.Sprintf("--release-semver=%s", testMetadata.ReleaseVersion),
}))
err := cmd.Execute()
Expect(err).NotTo(HaveOccurred())
Expand Down

0 comments on commit cc2d4e8

Please sign in to comment.