@@ -17,16 +17,12 @@ limitations under the License.
1717package main
1818
1919import (
20- "bytes"
2120 "context"
22- "os"
2321 "testing"
24- "time"
2522
26- "github.com/deckhouse/deckhouse/pkg/log"
2723 "github.com/deckhouse/module-sdk/pkg"
2824 "github.com/deckhouse/module-sdk/testing/mock"
29- . "github.com/onsi/ginkgo"
25+ . "github.com/onsi/ginkgo/v2 "
3026 . "github.com/onsi/gomega"
3127)
3228
@@ -36,37 +32,19 @@ func TestDiscoveryVirthandlerNodes(t *testing.T) {
3632}
3733
3834var _ = Describe ("Discovery virt-handler nodes" , func () {
39- err := os .Setenv ("D8_IS_TESTS_ENVIRONMENT" , "true" )
40- Expect (err ).ShouldNot (HaveOccurred ())
41-
4235 var (
43- snapshots * mock.SnapshotsMock
44- values * mock.PatchableValuesCollectorMock
45- patchCollector * mock.PatchCollectorMock
46- input * pkg.HookInput
47- buf * bytes.Buffer
36+ snapshots * mock.SnapshotsMock
37+ values * mock.PatchableValuesCollectorMock
38+ input * pkg.HookInput
4839 )
4940
5041 BeforeEach (func () {
5142 snapshots = mock .NewSnapshotsMock (GinkgoT ())
5243 values = mock .NewPatchableValuesCollectorMock (GinkgoT ())
53- patchCollector = mock .NewPatchCollectorMock (GinkgoT ())
54-
55- buf = bytes .NewBuffer ([]byte {})
5644
5745 input = & pkg.HookInput {
5846 Values : values ,
5947 Snapshots : snapshots ,
60- Logger : log .NewLogger (log.Options {
61- Level : log .LevelDebug .Level (),
62- Output : buf ,
63- TimeFunc : func (_ time.Time ) time.Time {
64- parsedTime , err := time .Parse (time .DateTime , "2006-01-02 15:04:05" )
65- Expect (err ).ShouldNot (HaveOccurred ())
66- return parsedTime
67- },
68- }),
69- PatchCollector : patchCollector ,
7048 }
7149 })
7250
@@ -76,7 +54,7 @@ var _ = Describe("Discovery virt-handler nodes", func() {
7654 []pkg.Snapshot {},
7755 )
7856 values .SetMock .When (virtHandlerNodeCountPath , 0 )
79- err := handleDiscoveryVirtHandkerNodes (context .Background (), input )
57+ err := handleDiscoveryVirtHandlerNodes (context .Background (), input )
8058 Expect (err ).ShouldNot (HaveOccurred ())
8159 })
8260 })
@@ -92,7 +70,7 @@ var _ = Describe("Discovery virt-handler nodes", func() {
9270 )
9371
9472 values .SetMock .When (virtHandlerNodeCountPath , 2 )
95- err := handleDiscoveryVirtHandkerNodes (context .Background (), input )
73+ err := handleDiscoveryVirtHandlerNodes (context .Background (), input )
9674 Expect (err ).ShouldNot (HaveOccurred ())
9775 })
9876 })
0 commit comments