diff options
author | 2019-07-03 20:12:51 +0100 | |
---|---|---|
committer | 2019-07-03 20:12:51 +0100 | |
commit | f5fe98395e2777907cdbfee08d37f12b4c1931c7 (patch) | |
tree | 31fcf4ac6eea214db71a3f44193226a338db01e0 /coremain/run_test.go | |
parent | e0c373ec12c7c043022fb9779da97f095b7f5bf8 (diff) | |
download | coredns-f5fe98395e2777907cdbfee08d37f12b4c1931c7.tar.gz coredns-f5fe98395e2777907cdbfee08d37f12b4c1931c7.tar.zst coredns-f5fe98395e2777907cdbfee08d37f12b4c1931c7.zip |
Remove -cpu flag (#2793)
The -cpu flag is a weird one (and copied originally from Caddy), it
basically sets GOMAXPROCS which can be *easily* done by just setting
that environment variable. Also with systemd and containerized env you
set this externally *anyway*, so there is little use to do this again in
the binary.
Also the option's help was confusing (i.e. percentage of what?). Remove
the option and supporting files.
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'coremain/run_test.go')
-rw-r--r-- | coremain/run_test.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/coremain/run_test.go b/coremain/run_test.go deleted file mode 100644 index da01637d8..000000000 --- a/coremain/run_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package coremain - -import ( - "runtime" - "testing" -) - -func TestSetCPU(t *testing.T) { - currentCPU := runtime.GOMAXPROCS(-1) - maxCPU := runtime.NumCPU() - halfCPU := int(0.5 * float32(maxCPU)) - if halfCPU < 1 { - halfCPU = 1 - } - for i, test := range []struct { - input string - output int - shouldErr bool - }{ - {"1", 1, false}, - {"-1", currentCPU, true}, - {"0", currentCPU, true}, - {"100%", maxCPU, false}, - {"50%", halfCPU, false}, - {"110%", currentCPU, true}, - {"-10%", currentCPU, true}, - {"invalid input", currentCPU, true}, - {"invalid input%", currentCPU, true}, - {"9999", maxCPU, false}, // over available CPU - } { - err := setCPU(test.input) - if test.shouldErr && err == nil { - t.Errorf("Test %d: Expected error, but there wasn't any", i) - } - if !test.shouldErr && err != nil { - t.Errorf("Test %d: Expected no error, but there was one: %v", i, err) - } - if actual, expected := runtime.GOMAXPROCS(-1), test.output; actual != expected { - t.Errorf("Test %d: GOMAXPROCS was %d but expected %d", i, actual, expected) - } - // teardown - runtime.GOMAXPROCS(currentCPU) - } -} |