Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xorpaul committed Nov 7, 2017
1 parent 0d07d80 commit d1b6c5c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func readConfigfile(configFile string) ConfigSettings {
config.Maxworker = maxworker
}

if maxworker == 0 && config.Maxworker == 0 {
config.Maxworker = 50
}

// set default max Go routines for Forge and Git module extracting
if !(config.MaxExtractworker > 0) {
config.MaxExtractworker = maxExtractworker
Expand All @@ -83,6 +87,10 @@ func readConfigfile(configFile string) ConfigSettings {
config.MaxExtractworker = maxExtractworker
}

if maxExtractworker == 0 && config.MaxExtractworker == 0 {
config.MaxExtractworker = 20
}

return config
}

Expand Down
6 changes: 3 additions & 3 deletions g10k_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestConfigPrefix(t *testing.T) {
ModulesCacheDir: "/tmp/g10k/modules/", EnvCacheDir: "/tmp/g10k/environments/",
Git: Git{privateKey: "", username: ""},
Forge: Forge{Baseurl: "https://forgeapi.puppetlabs.com"},
Sources: s, Timeout: 5, Maxworker: 50}
Sources: s, Timeout: 5, Maxworker: 50, MaxExtractworker: 20}

if !reflect.DeepEqual(got, expected) {
t.Errorf("Expected ConfigSettings: %+v, but got ConfigSettings: %+v", expected, got)
Expand All @@ -61,7 +61,7 @@ func TestConfigForceForgeVersions(t *testing.T) {
ModulesCacheDir: "/tmp/g10k/modules/", EnvCacheDir: "/tmp/g10k/environments/",
Git: Git{privateKey: "", username: ""},
Forge: Forge{Baseurl: "https://forgeapi.puppetlabs.com"},
Sources: s, Timeout: 5, Maxworker: 50}
Sources: s, Timeout: 5, Maxworker: 50, MaxExtractworker: 20}

if !reflect.DeepEqual(got, expected) {
t.Errorf("Expected ConfigSettings: %+v, but got ConfigSettings: %+v", expected, got)
Expand All @@ -81,7 +81,7 @@ func TestConfigAddWarning(t *testing.T) {
ModulesCacheDir: "/tmp/g10k/modules/", EnvCacheDir: "/tmp/g10k/environments/",
Git: Git{privateKey: "", username: ""},
Forge: Forge{Baseurl: "https://forgeapi.puppetlabs.com"},
Sources: s, Timeout: 5, Maxworker: 50}
Sources: s, Timeout: 5, Maxworker: 50, MaxExtractworker: 20}

if !reflect.DeepEqual(got, expected) {
t.Errorf("Expected ConfigSettings: %+v, but got ConfigSettings: %+v", expected, got)
Expand Down

0 comments on commit d1b6c5c

Please sign in to comment.