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

Commit

Permalink
init_app, base and update integration tests
Browse files Browse the repository at this point in the history
ignore upstream contents in 'base' integration tests

we run these tests twice, and the two runs produce differing outputs
  • Loading branch information
laverya committed May 1, 2019
1 parent 311ce2d commit f2609d8
Show file tree
Hide file tree
Showing 39 changed files with 1,074 additions and 37 deletions.
3 changes: 2 additions & 1 deletion integration/base/basic-stateless/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "RULNveQLrLj4GDum1yQhvKAcABh0GcLY"
release_version: "0.0.4"
no_state_file: true
set_channel_name: "integration-test-basic-and-docker"
set_channel_name: "integration-test-basic-and-docker"
skip_cleanup: false
1 change: 1 addition & 0 deletions integration/base/basic/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "RULNveQLrLj4GDum1yQhvKAcABh0GcLY"
release_version: "0.0.4"
set_channel_name: "integration-test-basic-and-docker"
skip_cleanup: false
1 change: 1 addition & 0 deletions integration/base/conditional-asset/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
disable_online: true
skip_cleanup: false
3 changes: 2 additions & 1 deletion integration/base/config-chain-override/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "t6-uzytbbkSoCiLtEfNO62LDIRLFec-2"
release_version: "0.0.1-test2"
set_channel_name: "integration-tests"
set_channel_name: "integration-tests"
skip_cleanup: false
3 changes: 2 additions & 1 deletion integration/base/config-chain/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "t6-uzytbbkSoCiLtEfNO62LDIRLFec-2"
release_version: "0.0.1-test2"
set_channel_name: "integration-tests"
set_channel_name: "integration-tests"
skip_cleanup: false
3 changes: 2 additions & 1 deletion integration/base/default-values/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "PYRBRKHcTSbMPFJqz3a_82p_kR00DPdz"
release_version: "0.1.4"
set_channel_name: "integration-test-default-vals"
set_channel_name: "integration-test-default-vals"
skip_cleanup: false
3 changes: 2 additions & 1 deletion integration/base/docker-layer/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "a5jOQ1Fnb5l-a2uXwFf-YFkUukeVWnbU"
release_version: "0.0.9"
set_channel_name: "integration-test-dockerlayer"
set_channel_name: "integration-test-dockerlayer"
skip_cleanup: false
1 change: 1 addition & 0 deletions integration/base/docker-push/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
disable_online: true
skip_cleanup: false
3 changes: 2 additions & 1 deletion integration/base/docker/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "RULNveQLrLj4GDum1yQhvKAcABh0GcLY"
release_version: "0.0.9"
set_channel_name: "integration-test-basic-and-docker"
set_channel_name: "integration-test-basic-and-docker"
skip_cleanup: false
2 changes: 2 additions & 0 deletions integration/base/entitlements-local/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ set_entitlements_json: |
}
]
}
skip_cleanup: false
3 changes: 2 additions & 1 deletion integration/base/github/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "RULNveQLrLj4GDum1yQhvKAcABh0GcLY"
release_version: "0.0.4"
set_github_contents: "replicatedhq/test-charts:/release.yml:master:.ship"
disable_online: true
disable_online: true
skip_cleanup: false
12 changes: 10 additions & 2 deletions integration/base/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@ var _ = Describe("ship app", func() {
err := cmd.Execute()
Expect(err).NotTo(HaveOccurred())

ignoreUpstreamContents := map[string][]string{
".ship/state.json": {"v1.upstreamContents"},
}

//compare the files in the temporary directory with those in the "expected" directory
result, err := integration.CompareDir(path.Join(testPath, "expected"), testOutputPath, map[string]string{
"__upstream__": strings.Replace(upstream, "&", "\\u0026", -1),
}, []string{}, []map[string][]string{})
}, []string{}, ignoreUpstreamContents)
Expect(err).NotTo(HaveOccurred())
Expect(result).To(BeTrue())
}, 60)
Expand Down Expand Up @@ -146,10 +150,14 @@ var _ = Describe("ship app", func() {
err := cmd.Execute()
Expect(err).NotTo(HaveOccurred())

ignoreUpstreamContents := map[string][]string{
".ship/state.json": {"v1.upstreamContents"},
}

//compare the files in the temporary directory with those in the "expected" directory
result, err := integration.CompareDir(path.Join(testPath, "expected"), testOutputPath, map[string]string{
"__upstream__": strings.Replace(upstream, "&", "\\u0026", -1),
}, []string{}, []map[string][]string{})
}, []string{}, ignoreUpstreamContents)
Expect(err).NotTo(HaveOccurred())
Expect(result).To(BeTrue())
}, 60)
Expand Down
1 change: 1 addition & 0 deletions integration/base/render-root/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ customer_id: ""
installation_id: ""
release_version: ""
disable_online: true
skip_cleanup: false
3 changes: 2 additions & 1 deletion integration/base/web/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
customer_id: "-Am-_6i5pw0u4AbspOwKN4lZUCn49u_G"
installation_id: "6-TGyWWOCG-6hmsa4R1zz9jOL9CWPJy7"
release_version: "0.0.7"
set_channel_name: "integration-test-web"
set_channel_name: "integration-test-web"
skip_cleanup: false
2 changes: 1 addition & 1 deletion integration/init/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var _ = Describe("ship init with arbitrary upstream", func() {
Expect(err).NotTo(HaveOccurred())

// compare the files in the temporary directory with those in the "expected" directory
result, err := integration.CompareDir(path.Join(testPath, "expected"), testOutputPath, replacements, []string{}, []map[string][]string{})
result, err := integration.CompareDir(path.Join(testPath, "expected"), testOutputPath, replacements, []string{}, map[string][]string{})
Expect(err).NotTo(HaveOccurred())
Expect(result).To(BeTrue())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@
"sequence": 0,
"version": "1.0.0-amazon-eks-template"
},
"releaseName": "integration-replicated-app-amazon-eks-template"
"releaseName": "integration-replicated-app-amazon-eks-template",
"upstreamContents": {
"appRelease": {
"id": "NyhODuspYvV9pTHlmMt20KAxbMAE8swq",
"sequence": 0,
"channelId": "iEKGvV-NI-i6uFS89JAbdJCzAXP1b7wr",
"channelName": "integration replicated.app amazon-eks-template",
"channelIcon": "",
"semver": "1.0.0-amazon-eks-template",
"releaseNotes": "integration tests",
"spec": "assets:\n v1:\n - amazon_eks:\n dest: new/new_vpc.tf\n cluster_name: '{{repl ConfigOption \"name_source\" }}'\n region: \"us-west-2\"\n created_vpc:\n vpc_cidr: '{{repl ConfigOption \"cidr_source\" }}'\n zones:\n - '{{repl ConfigOption \"zone_source\" }}'\n - us-west-2b\n public_subnets:\n - \"10.0.1.0/24\"\n - \"10.0.2.0/24\"\n private_subnets:\n - \"10.0.129.0/24\"\n - \"10.0.130.0/24\"\n autoscaling_groups:\n - name: alpha\n group_size: \"3\"\n machine_type: '{{repl ConfigOption \"machine_source\" }}'\n - name: bravo\n group_size: \"1\"\n machine_type: m5.4xlarge\n - inline:\n dest: install.sh\n contents: |\n #!/bin/bash\n echo \"run:\"\n echo \"terraform apply -f new/new_vpc.tf\"\n echo \"kubectl apply -f kube.yaml --kubeconfig {{repl AmazonEKS (ConfigOption \"name_source\") }}\"\n mode: 0777\n - inline:\n dest: kube.yaml\n contents: |\n this is not a valid kubernetes yaml\n mode: 0777\n\nconfig:\n v1:\n - name: template_sources\n title: Template Function Sources\n description: testing testing 123\n items:\n - name: name_source\n title: Name Source\n default: cluster-name-template\n type: text\n - name: cidr_source\n title: CIDR Source\n default: \"10.0.0.0/16\"\n type: text\n - name: zone_source\n title: Zone Source\n default: \"us-west-2a\"\n type: text\n - name: machine_source\n title: Machine Source\n default: m5.2xlarge\n type: text\n\nlifecycle:\n v1:\n - message:\n contents: \"hi\"\n - render: {}\n - message:\n contents: \"bye\"\n",
"images": [],
"githubContents": [],
"created": "Fri Nov 02 2018 17:07:38 GMT+0000 (UTC)",
"entitlements": {}
}
}
}
}
18 changes: 17 additions & 1 deletion integration/init_app/basic/expected/.ship/state.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@
"sequence": 0,
"version": "1.0.2"
},
"releaseName": "integration-replicated-app-basic"
"releaseName": "integration-replicated-app-basic",
"upstreamContents": {
"appRelease": {
"id": "pAb_dFxe4M4TdvkPWSdgDhgtpDbOcGAM",
"sequence": 0,
"channelId": "lD4lzjnjwOYzKbNsjK0JlcpzF19PswXz",
"channelName": "integration replicated.app basic",
"channelIcon": "",
"semver": "1.0.2",
"releaseNotes": "integration tests",
"spec": "---\nassets:\n v1:\n - inline:\n contents: |\n #!/bin/bash\n echo \"installing nothing\"\n echo \"config option: {{repl ConfigOption \"test_option\" }}\"\n dest: ./scripts/install.sh\n mode: 0777\n - inline:\n contents: |\n #!/bin/bash\n echo \"tested nothing\"\n echo \"customer {{repl Installation \"customer_id\" }}\"\n echo \"install {{repl Installation \"installation_id\" }}\"\n dest: ./scripts/test.sh\n mode: 0777\nconfig:\n v1:\n - name: test_options\n title: Test Options\n description: testing testing 123\n items:\n - name: test_option\n title: Test Option\n default: abc123_test-option-value\n type: text\nlifecycle:\n v1:\n - render: {}\n",
"images": [],
"githubContents": [],
"created": "Tue Dec 04 2018 03:21:49 GMT+0000 (UTC)",
"entitlements": {}
}
}
}
}
31 changes: 30 additions & 1 deletion integration/init_app/docker-asset-slug/expected/.ship/state.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@
"sequence": 0,
"version": "0.0.1"
},
"contentSHA": "4e212691de81e471f76ea6ef8d236bae3874d0bc2f22487d17e3e4e42138a67f"
"contentSHA": "4e212691de81e471f76ea6ef8d236bae3874d0bc2f22487d17e3e4e42138a67f",
"upstreamContents": {
"appRelease": {
"id": "oVSYJqtZnSew_8A3fFuwz0WPwn40zjn6",
"sequence": 1,
"channelId": "kR3s2M1opgn7txyRbH7NsbsiJgMyz1ui",
"channelName": "Nightly",
"channelIcon": "",
"semver": "0.0.1",
"releaseNotes": "",
"spec": "---\nassets:\n v1:\n - docker:\n image: replicated/helloscratch:1.0.0\n source: public\n dest: docker/replicated-helloscratch-public.tar\n - docker:\n image: registry.staging.replicated.com/alpha/replicated-helloscratch:1.0.0\n source: replicated-qa\n dest: docker/replicated-helloscratch-private.tar\nconfig:\n v1: []\nlifecycle:\n v1:\n - render: {}",
"images": [
{
"url": "replicated/helloscratch:1.0.0",
"source": "public",
"appSlug": "ship-private-image",
"imageKey": ""
},
{
"url": "registry.staging.replicated.com/alpha/replicated-helloscratch:1.0.0",
"source": "replicated-qa",
"appSlug": "ship-private-image",
"imageKey": "6e8bj5x3cwerg"
}
],
"githubContents": [],
"created": "Tue Mar 19 2019 00:47:09 GMT+0000 (UTC)",
"entitlements": {}
}
}
}
}
31 changes: 30 additions & 1 deletion integration/init_app/docker-asset/expected/.ship/state.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@
"sequence": 0,
"version": "1.0.0-SNAPSHOT"
},
"contentSHA": "a551e7640f88bd4d9e5843ea7602c046a1b89feae744c521bee558f9e44f0a69"
"contentSHA": "a551e7640f88bd4d9e5843ea7602c046a1b89feae744c521bee558f9e44f0a69",
"upstreamContents": {
"appRelease": {
"id": "jDtI-DiraCbkN5euJHmbS3kIFw4N1Iw9",
"sequence": 0,
"channelId": "_KVsR5SFu9Rj2IR6dxPhuBYcNIKtw6SI",
"channelName": "integration-test-docker",
"channelIcon": "",
"semver": "1.0.0-SNAPSHOT",
"releaseNotes": "",
"spec": "---\nassets:\n v1:\n - docker:\n image: replicated/helloscratch:1.0.0\n source: public\n dest: docker/replicated-helloscratch-public.tar\n - docker:\n image: registry.staging.replicated.com/alpha/replicated-helloscratch:1.0.0\n source: replicated-qa\n dest: docker/replicated-helloscratch-private.tar\nconfig:\n v1: []\nlifecycle:\n v1:\n - render: {}\n",
"images": [
{
"url": "replicated/helloscratch:1.0.0",
"source": "public",
"appSlug": "",
"imageKey": ""
},
{
"url": "registry.staging.replicated.com/alpha/replicated-helloscratch:1.0.0",
"source": "replicated-qa",
"appSlug": "",
"imageKey": "6e8bj5x3cwerg"
}
],
"githubContents": [],
"created": "Fri Jan 18 2019 20:45:25 GMT+0000 (UTC)",
"entitlements": {}
}
}
}
}
101 changes: 101 additions & 0 deletions integration/init_app/github-template-func/expected/.ship/state.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,107 @@
"sequence": 0,
"version": "1.0.1-SNAPSHOT"
},
"upstreamContents": {
"appRelease": {
"id": "ZibGNlJOl0RbgXiFKk358iGVL8lFOn26",
"sequence": 0,
"channelId": "M2JHDvnDhJbrDNRBQ1m-eEDRXbPiSLg9",
"channelName": "integration replicated.app github-template-func",
"channelIcon": "",
"semver": "1.0.1-SNAPSHOT",
"releaseNotes": "integration tests",
"spec": "---\nassets:\n v1:\n - inline:\n contents: |\n #!/bin/bash\n echo \"installing nothing\"\n echo \"semver: {{repl Installation \"semver\" }}\"\n dest: ./scripts/install.sh\n mode: 0777\n - github:\n repo: replicatedhq/test-charts\n path: template-functions/\n dest: ./github-slash\n source: public\n ref: ad1e78d13c33fae7a7ce22ed19920945ceea23e9\n - github:\n repo: replicatedhq/test-charts\n path: template-functions\n dest: ./github-noslash\n source: public\n ref: ad1e78d13c33fae7a7ce22ed19920945ceea23e9\n - github:\n repo: replicatedhq/test-charts\n path: template-functions\n dest: ./github-stripped\n strip_path: \"{{repl ParseBool \\\"true\\\"}}\"\n source: public\n ref: ad1e78d13c33fae7a7ce22ed19920945ceea23e9\nconfig:\n v1:\n - name: option_group\n title: Test Option\n description: testing testing 123\n items:\n - name: option\n type: text\n value: abc123\n\nlifecycle:\n v1:\n - config: {}\n - render: {}\n",
"images": [],
"githubContents": [
{
"repo": "replicatedhq/test-charts",
"path": "template-functions/",
"ref": "ad1e78d13c33fae7a7ce22ed19920945ceea23e9",
"files": [
{
"name": "config.md",
"path": "template-functions/config.md",
"sha": "",
"size": 122,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIENvbmZpZyBzdWl0ZSBvZiB0ZW1wbGF0ZSBmdW5jdGlvbnMgaW4gU2hpcAoKQ29uZmlnIG9wdGlvbjoge3tyZXBsIENvbmZpZ09wdGlvbiAib3B0aW9uIiB9fQo="
},
{
"name": "installation.md",
"path": "template-functions/installation.md",
"sha": "",
"size": 129,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIEludGVncmF0aW9uIHN1aXRlIG9mIHRlbXBsYXRlIGZ1bmN0aW9ucyBpbiBTaGlwCgpSZWxlYXNlIHNlbXZlcjoge3tyZXBsIEluc3RhbGxhdGlvbiAic2VtdmVyIiB9fQoK"
},
{
"name": "static.md",
"path": "template-functions/static.md",
"sha": "",
"size": 146,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIFN0YXRpYyBzdWl0ZSBvZiB0ZW1wbGF0ZSBmdW5jdGlvbnMgaW4gU2hpcAoKVHdvUGx1c1R3bzoge3tyZXBsIEFkZCAyIDIgfX0KVVBQRVJDQVNFOiB7e3JlcGwgVG9VcHBlciAidXBwZXJjYXNlIiB9fQo="
}
]
},
{
"repo": "replicatedhq/test-charts",
"path": "template-functions",
"ref": "ad1e78d13c33fae7a7ce22ed19920945ceea23e9",
"files": [
{
"name": "config.md",
"path": "template-functions/config.md",
"sha": "",
"size": 122,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIENvbmZpZyBzdWl0ZSBvZiB0ZW1wbGF0ZSBmdW5jdGlvbnMgaW4gU2hpcAoKQ29uZmlnIG9wdGlvbjoge3tyZXBsIENvbmZpZ09wdGlvbiAib3B0aW9uIiB9fQo="
},
{
"name": "installation.md",
"path": "template-functions/installation.md",
"sha": "",
"size": 129,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIEludGVncmF0aW9uIHN1aXRlIG9mIHRlbXBsYXRlIGZ1bmN0aW9ucyBpbiBTaGlwCgpSZWxlYXNlIHNlbXZlcjoge3tyZXBsIEluc3RhbGxhdGlvbiAic2VtdmVyIiB9fQoK"
},
{
"name": "static.md",
"path": "template-functions/static.md",
"sha": "",
"size": 146,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIFN0YXRpYyBzdWl0ZSBvZiB0ZW1wbGF0ZSBmdW5jdGlvbnMgaW4gU2hpcAoKVHdvUGx1c1R3bzoge3tyZXBsIEFkZCAyIDIgfX0KVVBQRVJDQVNFOiB7e3JlcGwgVG9VcHBlciAidXBwZXJjYXNlIiB9fQo="
}
]
},
{
"repo": "replicatedhq/test-charts",
"path": "template-functions",
"ref": "ad1e78d13c33fae7a7ce22ed19920945ceea23e9",
"files": [
{
"name": "config.md",
"path": "template-functions/config.md",
"sha": "",
"size": 122,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIENvbmZpZyBzdWl0ZSBvZiB0ZW1wbGF0ZSBmdW5jdGlvbnMgaW4gU2hpcAoKQ29uZmlnIG9wdGlvbjoge3tyZXBsIENvbmZpZ09wdGlvbiAib3B0aW9uIiB9fQo="
},
{
"name": "installation.md",
"path": "template-functions/installation.md",
"sha": "",
"size": 129,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIEludGVncmF0aW9uIHN1aXRlIG9mIHRlbXBsYXRlIGZ1bmN0aW9ucyBpbiBTaGlwCgpSZWxlYXNlIHNlbXZlcjoge3tyZXBsIEluc3RhbGxhdGlvbiAic2VtdmVyIiB9fQoK"
},
{
"name": "static.md",
"path": "template-functions/static.md",
"sha": "",
"size": 146,
"data": "I1RoaXMgZmlsZSB0ZXN0cyBhIHBhcnQgb2YgdGhlIFN0YXRpYyBzdWl0ZSBvZiB0ZW1wbGF0ZSBmdW5jdGlvbnMgaW4gU2hpcAoKVHdvUGx1c1R3bzoge3tyZXBsIEFkZCAyIDIgfX0KVVBQRVJDQVNFOiB7e3JlcGwgVG9VcHBlciAidXBwZXJjYXNlIiB9fQo="
}
]
}
],
"created": "Fri Nov 02 2018 17:07:52 GMT+0000 (UTC)",
"entitlements": {}
}
},
"releaseName": "integration-replicated-app-github-template-func"
}
}
Loading

0 comments on commit f2609d8

Please sign in to comment.