Fix a unit test failure in non English languages

This is a result in Japanese language.

$ make test WHAT=./staging/src/k8s.io/kubectl/pkg/cmd/diff
[0402 07:24:05] Running tests without code coverage
FAIL: TestDiffProgram (0.00s)
    diff_test.go:73: stdout = "ファイル /dev/zero と /dev/zero は同一です\n", expected = Files /dev/zero and /dev/zero are identical
        "
FAIL
FAIL	k8s.io/kubernetes/staging/src/k8s.io/kubectl/pkg/cmd/diff	0.045s
FAIL
make: *** [Makefile:184: test] エラー 1
This commit is contained in:
Masashi Honma 2021-04-02 15:59:47 +09:00
parent a651804427
commit 6b9ff98dd7

View File

@ -54,6 +54,11 @@ func (f *FakeObject) Live() runtime.Object {
func TestDiffProgram(t *testing.T) {
externalDiffCommands := [3]string{"diff", "diff -ruN", "diff --report-identical-files"}
if oriLang := os.Getenv("LANG"); oriLang != "C" {
os.Setenv("LANG", "C")
defer os.Setenv("LANG", oriLang)
}
for i, c := range externalDiffCommands {
os.Setenv("KUBECTL_EXTERNAL_DIFF", c)
streams, _, stdout, _ := genericclioptions.NewTestIOStreams()