Skip to content

Commit e970bca

Browse files
committed
Add acceptance test coverage for new features
* update-release --without-download * update-stemcell --without-download * updating_stemcell --update-releases
1 parent 48e841b commit e970bca

File tree

4 files changed

+88
-6
lines changed

4 files changed

+88
-6
lines changed

internal/acceptance/workflows/scenario/initialize.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ func InitializeKiln(ctx *godog.ScenarioContext) { initializeKiln(ctx) }
5555
func initializeKiln(ctx scenarioContext) {
5656
ctx.Step(regexp.MustCompile(`^I invoke kiln$`), iInvokeKiln)
5757
ctx.Step(regexp.MustCompile(`^I try to invoke kiln$`), iTryToInvokeKiln)
58+
ctx.Step(regexp.MustCompile(`^the "([^"]*)" release tarball exists$`), theReleaseTarballExists)
59+
ctx.Step(regexp.MustCompile(`^the "([^"]*)" release tarball does not exist$`), theReleaseTarballDoesNotExist)
5860
}
5961

6062
func InitializeRegex(ctx *godog.ScenarioContext) { initializeRegex(ctx) }

internal/acceptance/workflows/scenario/step_funcs_kiln.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os"
7+
"path/filepath"
78
"regexp"
89
"strings"
910

@@ -18,6 +19,36 @@ func iTryToInvokeKiln(ctx context.Context, table *godog.Table) (context.Context,
1819
return invokeKiln(ctx, false, argsFromTable(table)...)
1920
}
2021

22+
func theReleaseTarballExists(ctx context.Context, tarballName string) error {
23+
tileDir, err := tileRepoPath(ctx)
24+
if err != nil {
25+
return fmt.Errorf("failed to get tile repo path: %w", err)
26+
}
27+
28+
releasePath := filepath.Join(tileDir, "releases", tarballName)
29+
_, err = os.Stat(releasePath)
30+
return err
31+
}
32+
33+
func theReleaseTarballDoesNotExist(ctx context.Context, tarballName string) error {
34+
tileDir, err := tileRepoPath(ctx)
35+
if err != nil {
36+
return fmt.Errorf("failed to get tile repo path: %w", err)
37+
}
38+
39+
releasePath := filepath.Join(tileDir, "releases", tarballName)
40+
_, err = os.Stat(releasePath)
41+
if err == nil {
42+
return fmt.Errorf("release tarball %q exists", tarballName)
43+
}
44+
45+
if !os.IsNotExist(err) {
46+
return err
47+
}
48+
49+
return nil
50+
}
51+
2152
func kilnValidateSucceeds(ctx context.Context) (context.Context, error) {
2253
return invokeKiln(ctx, true, "validate", "--variable=github_access_token=banana")
2354
}

internal/acceptance/workflows/updating_releases.feature

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,38 @@ Feature: As a dependabot, I want to update a BOSH Release
1111

1212
Scenario: Find a version on bosh.io
1313
Given I have a tile source directory "testdata/tiles/v2"
14+
And the repository has no fetched releases
1415
And I set the version constraint to "1.1.18" for release "bpm"
1516
When I invoke kiln
1617
| find-release-version |
1718
| --release=bpm |
1819
| --variable=github_access_token="${GITHUB_ACCESS_TOKEN}" |
1920
Then stdout contains substring: "1.1.18"
2021

21-
Scenario: Update a component to a new release
22+
Scenario: Update a component to a new release with download
2223
Given I have a tile source directory "testdata/tiles/v2"
24+
And the repository has no fetched releases
2325
And the Kilnfile.lock specifies version "0.2.3" for release "hello-release"
24-
And GitHub repository "crhntr/hello-release" has release with tag "v0.2.3"
26+
And GitHub repository "crhntr/hello-release" has release with tag "0.3.0"
2527
When I invoke kiln
2628
| update-release |
2729
| --name=hello-release |
28-
| --version=v0.2.3 |
30+
| --version=0.3.0 |
31+
| --variable=github_access_token="${GITHUB_ACCESS_TOKEN}" |
32+
Then the Kilnfile.lock specifies version "0.3.0" for release "hello-release"
33+
And kiln validate succeeds
34+
And the "hello-release-0.3.0.tgz" release tarball exists
35+
36+
Scenario: Update a component to a new release without download
37+
Given I have a tile source directory "testdata/tiles/v2"
38+
And the repository has no fetched releases
39+
And the Kilnfile.lock specifies version "1.2.12" for release "bpm"
40+
When I invoke kiln
41+
| update-release |
42+
| --name=bpm |
43+
| --version=1.2.13 |
2944
| --without-download |
3045
| --variable=github_access_token="${GITHUB_ACCESS_TOKEN}" |
31-
Then the Kilnfile.lock specifies version "0.2.3" for release "hello-release"
46+
Then the Kilnfile.lock specifies version "1.2.13" for release "bpm"
3247
And kiln validate succeeds
48+
And the "bpm-1.2.13.tgz" release tarball does not exist

internal/acceptance/workflows/updating_stemcell.feature

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,45 @@ Feature: As a dependabot, I want to update a stemcell
1313
| --variable=github_access_token="${GITHUB_ACCESS_TOKEN}" |
1414
Then stdout contains substring: "1.340"
1515

16-
Scenario: Update the stemcell
16+
Scenario: Update the stemcell with download
1717
Given I have a tile source directory "testdata/tiles/v2"
18+
And the repository has no fetched releases
1819
And TanzuNetwork has product "stemcells-ubuntu-jammy" with version "1.340"
1920
And "Kilnfile.lock" contains substring: version: "1.329"
2021
When I invoke kiln
2122
| update-stemcell |
22-
| --version=1.340 |
23+
| --version=1.340 |
2324
| --variable=github_access_token="${GITHUB_ACCESS_TOKEN}" |
2425
Then "Kilnfile.lock" contains substring: version: "1.340"
26+
And the Kilnfile.lock specifies version "0.2.3" for release "hello-release"
27+
And the "bpm-1.2.12.tgz" release tarball exists
28+
And the "hello-release-0.2.3.tgz" release tarball exists
29+
30+
Scenario: Update the stemcell without download
31+
Given I have a tile source directory "testdata/tiles/v2"
32+
And the repository has no fetched releases
33+
And TanzuNetwork has product "stemcells-ubuntu-jammy" with version "1.340"
34+
And "Kilnfile.lock" contains substring: version: "1.329"
35+
When I invoke kiln
36+
| update-stemcell |
37+
| --version=1.340 |
38+
| --without-download |
39+
| --variable=github_access_token="${GITHUB_ACCESS_TOKEN}" |
40+
Then "Kilnfile.lock" contains substring: version: "1.340"
41+
And the Kilnfile.lock specifies version "0.2.3" for release "hello-release"
42+
And the "bpm-1.2.12.tgz" release tarball does not exist
43+
And the "hello-release-0.2.3.tgz" release tarball does not exist
44+
45+
Scenario: Update the stemcell with release updates
46+
Given I have a tile source directory "testdata/tiles/v2"
47+
And the repository has no fetched releases
48+
And TanzuNetwork has product "stemcells-ubuntu-jammy" with version "1.340"
49+
And "Kilnfile.lock" contains substring: version: "1.329"
50+
When I invoke kiln
51+
| update-stemcell |
52+
| --version=1.340 |
53+
| --update-releases |
54+
| --variable=github_access_token="${GITHUB_ACCESS_TOKEN}" |
55+
Then "Kilnfile.lock" contains substring: version: "1.340"
56+
And the Kilnfile.lock specifies version "0.3.0" for release "hello-release"
57+
And the "hello-release-0.3.0.tgz" release tarball exists

0 commit comments

Comments
 (0)