Skip to content

Commit 6791785

Browse files
committed
extension e2e: cleanup for readonly GOMODCACHE dir
Signed-off-by: mathetake <[email protected]>
1 parent 0bb6003 commit 6791785

File tree

8 files changed

+16
-5
lines changed

8 files changed

+16
-5
lines changed

pkg/cmd/extension/init/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
var (
29-
// extension categories supported by the `init` command.
29+
// SupportedCategories ... extension categories supported by the `init` command for each language.
3030
SupportedCategories = map[string]options{
3131
extension.LanguageRust.String(): {
3232
{Value: extension.EnvoyHTTPFilter.String(), DisplayText: "HTTP Filter"},
@@ -38,7 +38,7 @@ var (
3838
// {Value: extension.EnvoyNetworkFilter.String(), DisplayText: "Network Filter"},
3939
},
4040
}
41-
// programming languages supported by the `init` command.
41+
// SupportedLanguages ... programming languages supported by the `init` command.
4242
SupportedLanguages = options{
4343
{Value: extension.LanguageRust.String(), DisplayText: "Rust"},
4444
{Value: extension.LanguageTinyGo.String(), DisplayText: "TinyGo"},

pkg/cmd/extension/init/options.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ type option struct {
2121
}
2222

2323
// options represents an exhaustive list of valid configuration values.
24-
type options []option
24+
type options []*option
2525

2626
func (o options) Contains(value string) bool {
2727
return o.IndexOf(value) >= 0
2828
}
2929

3030
func (o options) ByValue(value string) *option {
3131
if i := o.IndexOf(value); i >= 0 {
32-
return &o[i]
32+
return o[i]
3333
}
3434
return nil
3535
}

test/e2e/e2e_suite_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ var _ = BeforeEach(func() {
5454
})
5555

5656
var _ = AfterEach(func() {
57-
GetEnvoy("extension clean")
5857
if tempDir != "" {
5958
Expect(os.RemoveAll(tempDir)).To(Succeed())
6059
}
6160
})
61+
62+
func cleanUpExtensionDir(dir string) {
63+
Expect(os.Chdir(dir)).To(Succeed())
64+
clean := GetEnvoy("extension clean")
65+
_, _, err := clean.Exec()
66+
Expect(err).To(Succeed())
67+
}

test/e2e/getenvoy_extension_build_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ var _ = Describe("getenvoy extension build", func() {
7878
toolchain, err := toolchains.LoadToolchain(toolchains.Default, workspace)
7979
Expect(err).NotTo(HaveOccurred())
8080
Expect(toolchain).NotTo(BeNil())
81+
cleanUpExtensionDir(outputDir)
8182
},
8283
testCases()...,
8384
)

test/e2e/getenvoy_extension_examples_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ default
120120
121121
Use "getenvoy extension examples add --help" for more information on how to add one.
122122
`))
123+
cleanUpExtensionDir(outputDir)
123124
},
124125
testCases()...,
125126
)

test/e2e/getenvoy_extension_init_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ var _ = Describe("getenvoy extension init", func() {
102102

103103
By("verifying output directory")
104104
VerifyOutputDir(given, outputDir)
105+
cleanUpExtensionDir(outputDir)
105106
},
106107
testCases()...,
107108
)

test/e2e/getenvoy_extension_run_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ var _ = Describe("getenvoy extension run", func() {
189189
})
190190
Expect(err).NotTo(HaveOccurred())
191191
Expect(dumpFiles).To(ContainElements("config_dump.json", "stats.json"))
192+
cleanUpExtensionDir(outputDir)
192193
},
193194
testCases()...,
194195
)

test/e2e/getenvoy_extension_test_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ var _ = Describe("getenvoy extension test", func() {
6767
// apparently, use of `-t` option in `docker run` causes stderr to be incorporated into stdout
6868
Expect(stdout).NotTo(BeEmpty())
6969
Expect(stderr).To(BeEmpty())
70+
cleanUpExtensionDir(outputDir)
7071
},
7172
testCases()...,
7273
)

0 commit comments

Comments
 (0)