From 99b7f2093b5bfecd14d140a6867c7f9a4da468ca Mon Sep 17 00:00:00 2001 From: Shengjing Zhu Date: Sun, 10 Jan 2021 04:26:19 +0800 Subject: [PATCH] Add patch to set year to fixed value in golden tests (Closes: #979583) --- ...-year-to-fixed-value-in-golden-tests.patch | 42 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 43 insertions(+) create mode 100644 debian/patches/0001-Set-year-to-fixed-value-in-golden-tests.patch create mode 100644 debian/patches/series diff --git a/debian/patches/0001-Set-year-to-fixed-value-in-golden-tests.patch b/debian/patches/0001-Set-year-to-fixed-value-in-golden-tests.patch new file mode 100644 index 0000000..6f3aeb8 --- /dev/null +++ b/debian/patches/0001-Set-year-to-fixed-value-in-golden-tests.patch @@ -0,0 +1,42 @@ +From: Shengjing Zhu +Date: Sun, 10 Jan 2021 04:25:26 +0800 +Subject: Set year to fixed value in golden tests + +--- + cobra/cmd/add_test.go | 5 +++++ + cobra/cmd/init_test.go | 3 +++ + 2 files changed, 8 insertions(+) + +diff --git a/cobra/cmd/add_test.go b/cobra/cmd/add_test.go +index de92fce..ccaac8b 100644 +--- a/cobra/cmd/add_test.go ++++ b/cobra/cmd/add_test.go +@@ -4,9 +4,14 @@ import ( + "fmt" + "os" + "testing" ++ ++ "github.com/spf13/viper" + ) + + func TestGoldenAddCmd(t *testing.T) { ++ viper.Set("year", "2020") ++ defer viper.Set("year", nil) ++ + command := &Command{ + CmdName: "test", + CmdParent: parentName, +diff --git a/cobra/cmd/init_test.go b/cobra/cmd/init_test.go +index c4b3f09..96f2608 100644 +--- a/cobra/cmd/init_test.go ++++ b/cobra/cmd/init_test.go +@@ -30,6 +30,9 @@ func TestGoldenInitCmd(t *testing.T) { + } + defer os.RemoveAll(dir) + ++ viper.Set("year", "2020") ++ defer viper.Set("year", nil) ++ + tests := []struct { + name string + args []string diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..e0ae253 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Set-year-to-fixed-value-in-golden-tests.patch -- GitLab