Skip to content

Commit c3b41b2

Browse files
authored
Merge pull request #4116 from apostasie/tigron-env
[Tigron]: allow per-command environment override
2 parents f9000f2 + d88b9df commit c3b41b2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

mod/tigron/.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ linters:
5757
settings:
5858
interfacebloat:
5959
# Default is 10
60-
max: 13
60+
max: 20
6161
revive:
6262
enable-all-rules: true
6363
rules:

mod/tigron/test/command.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ func (gc *GenericCommand) Feed(r io.Reader) {
130130
gc.cmd.Feed(r)
131131
}
132132

133+
func (gc *GenericCommand) Setenv(key, value string) {
134+
gc.cmd.Env[key] = value
135+
}
136+
133137
func (gc *GenericCommand) WithFeeder(fun func() io.Reader) {
134138
gc.cmd.WithFeeder(fun)
135139
}

mod/tigron/test/interfaces.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ type TestableCommand interface {
8989
WithCwd(path string)
9090
// WithTimeout defines the execution timeout for a command.
9191
WithTimeout(timeout time.Duration)
92+
// Setenv allows to override a specific env variable directly for a specific command instead of test-wide
93+
Setenv(key, value string)
9294
// WithFeeder allows passing a reader to be fed to the command stdin.
9395
WithFeeder(fun func() io.Reader)
9496
// Feed allows passing a reader to be fed to the command stdin.

0 commit comments

Comments
 (0)