Skip to content

Commit

Permalink
kola: Add --no-net flag
Browse files Browse the repository at this point in the history
The Docker Hub recently decided that us pulling the `nginx` image
over and over many times a day was abusive and started rate limiting
us.

For OSTree's test suite at least, there's no good reason for us
to run podman's tests at all.  Similarly for e.g. Ignition.

And just as a general rule I think it's useful to cleanly separate
tests that can be run fully offline from those that require
Internet access.
  • Loading branch information
cgwalters committed May 26, 2020
1 parent 26a1cc2 commit 7ec7aef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions mantle/cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func init() {
ss("debug-systemd-unit", []string{}, "full-unit-name.service to enable SYSTEMD_LOG_LEVEL=debug on. Can be specified multiple times.")
sv(&kola.Options.IgnitionVersion, "ignition-version", "", "Ignition version override: v2, v3")
ssv(&kola.BlacklistedTests, "blacklist-test", []string{}, "Test pattern to blacklist. Can be specified multiple times.")
bv(&kola.NoNet, "no-net", false, "Don't run tests that require an Internet connection")
ssv(&kola.Tags, "tag", []string{}, "Test tag to run. Can be specified multiple times.")
bv(&kola.Options.SSHOnTestFailure, "ssh-on-test-failure", false, "SSH into a machine when tests fail")
sv(&kola.Options.CosaWorkdir, "workdir", "", "coreos-assembler working directory")
Expand Down
16 changes: 14 additions & 2 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var (

TestParallelism int //glue var to set test parallelism from main
TAPFile string // if not "", write TAP results here
NoNet bool // Disable tests requiring Internet

BlacklistedTests []string // tests which are blacklisted
Tags []string // tags to be ran
Expand Down Expand Up @@ -242,11 +243,22 @@ func filterTests(tests map[string]*register.Test, patterns []string, pltfrm stri
checkPlatforms = append(checkPlatforms, "qemu")
}

var blacklisted bool
noPattern := hasString("*", patterns)
for name, t := range tests {
var noNetFiltered bool
var blacklisted bool
for _, flag := range t.Flags {
if flag == register.RequiresInternetAccess && NoNet {
noNetFiltered = true
break
}
}
if noNetFiltered {
plog.Debugf("Skipping test that requires network: %s", t.Name)
continue
}

// Drop anything which is blacklisted directly or by pattern
blacklisted = false
for _, bl := range BlacklistedTests {
match, err := filepath.Match(bl, t.Name)
if err != nil {
Expand Down

0 comments on commit 7ec7aef

Please sign in to comment.