Skip to content

Commit 92b4f55

Browse files
committed
reveritng back to previous change.
1 parent 9ac2877 commit 92b4f55

File tree

1 file changed

+36
-46
lines changed

1 file changed

+36
-46
lines changed

internal/commands/loglevel/set_test.go

Lines changed: 36 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,45 @@ limitations under the License.
1717
package loglevel_test
1818

1919
import (
20-
"context"
20+
"context"
2121

22-
. "github.com/onsi/ginkgo/v2"
23-
. "github.com/onsi/gomega"
24-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25-
"sigs.k8s.io/controller-runtime/pkg/client/fake"
22+
. "github.com/onsi/ginkgo/v2"
23+
. "github.com/onsi/gomega"
24+
"sigs.k8s.io/controller-runtime/pkg/client/fake"
2625

27-
libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
28-
"github.com/projectsveltos/sveltosctl/internal/commands/loglevel"
29-
"github.com/projectsveltos/sveltosctl/internal/utils"
26+
libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
27+
"github.com/projectsveltos/sveltosctl/internal/commands/loglevel"
28+
"github.com/projectsveltos/sveltosctl/internal/utils"
3029
)
3130

3231
var _ = Describe("Set", func() {
33-
It("set updates default DebuggingConfiguration instance", func() {
34-
scheme, err := utils.GetScheme()
35-
Expect(err).To(BeNil())
36-
c := fake.NewClientBuilder().WithScheme(scheme).Build()
37-
38-
utils.InitalizeManagementClusterAcces(scheme, nil, nil, c)
39-
40-
dc := &libsveltosv1alpha1.DebuggingConfiguration{
41-
ObjectMeta: metav1.ObjectMeta{
42-
Name: utils.DefaultInstanceName,
43-
},
44-
}
45-
err = c.Create(context.TODO(), dc)
46-
Expect(err).To(BeNil())
47-
48-
Expect(loglevel.UpdateDebuggingConfiguration(context.TODO(), libsveltosv1alpha1.LogLevelDebug,
49-
string(libsveltosv1alpha1.ComponentAddonManager), utils.DefaultInstanceName, "", "")).To(Succeed())
50-
51-
k8sAccess := utils.GetAccessInstance()
52-
53-
currentDC, err := k8sAccess.GetDebuggingConfiguration(context.TODO(), utils.DefaultInstanceName, "", "")
54-
Expect(err).To(BeNil())
55-
Expect(currentDC).ToNot(BeNil())
56-
Expect(currentDC.Spec.Configuration).ToNot(BeNil())
57-
Expect(len(currentDC.Spec.Configuration)).To(Equal(1))
58-
Expect(currentDC.Spec.Configuration[0].Component).To(Equal(libsveltosv1alpha1.ComponentAddonManager))
59-
Expect(currentDC.Spec.Configuration[0].LogLevel).To(Equal(libsveltosv1alpha1.LogLevelDebug))
60-
61-
Expect(loglevel.UpdateDebuggingConfiguration(context.TODO(), libsveltosv1alpha1.LogLevelInfo,
62-
string(libsveltosv1alpha1.ComponentAddonManager), utils.DefaultInstanceName, "", "")).To(Succeed())
63-
currentDC, err = k8sAccess.GetDebuggingConfiguration(context.TODO(), utils.DefaultInstanceName, "", "")
64-
Expect(err).To(BeNil())
65-
Expect(currentDC).ToNot(BeNil())
66-
Expect(currentDC.Spec.Configuration).ToNot(BeNil())
67-
Expect(len(currentDC.Spec.Configuration)).To(Equal(1))
68-
Expect(currentDC.Spec.Configuration[0].Component).To(Equal(libsveltosv1alpha1.ComponentAddonManager))
69-
Expect(currentDC.Spec.Configuration[0].LogLevel).To(Equal(libsveltosv1alpha1.LogLevelInfo))
70-
})
32+
It("set updates default DebuggingConfiguration instance", func() {
33+
scheme, err := utils.GetScheme()
34+
Expect(err).To(BeNil())
35+
c := fake.NewClientBuilder().WithScheme(scheme).Build()
36+
37+
utils.InitalizeManagementClusterAcces(scheme, nil, nil, c)
38+
Expect(loglevel.UpdateDebuggingConfiguration(context.TODO(), libsveltosv1alpha1.LogLevelDebug,
39+
string(libsveltosv1alpha1.ComponentAddonManager), "", "", "")).To(Succeed())
40+
41+
k8sAccess := utils.GetAccessInstance()
42+
43+
currentDC, err := k8sAccess.GetDebuggingConfiguration(context.TODO(), "", "", "")
44+
Expect(err).To(BeNil())
45+
Expect(currentDC).ToNot(BeNil())
46+
Expect(currentDC.Spec.Configuration).ToNot(BeNil())
47+
Expect(len(currentDC.Spec.Configuration)).To(Equal(1))
48+
Expect(currentDC.Spec.Configuration[0].Component).To(Equal(libsveltosv1alpha1.ComponentAddonManager))
49+
Expect(currentDC.Spec.Configuration[0].LogLevel).To(Equal(libsveltosv1alpha1.LogLevelDebug))
50+
51+
Expect(loglevel.UpdateDebuggingConfiguration(context.TODO(), libsveltosv1alpha1.LogLevelInfo,
52+
string(libsveltosv1alpha1.ComponentAddonManager), "", "", "")).To(Succeed())
53+
currentDC, err = k8sAccess.GetDebuggingConfiguration(context.TODO(), "", "", "")
54+
Expect(err).To(BeNil())
55+
Expect(currentDC).ToNot(BeNil())
56+
Expect(currentDC.Spec.Configuration).ToNot(BeNil())
57+
Expect(len(currentDC.Spec.Configuration)).To(Equal(1))
58+
Expect(currentDC.Spec.Configuration[0].Component).To(Equal(libsveltosv1alpha1.ComponentAddonManager))
59+
Expect(currentDC.Spec.Configuration[0].LogLevel).To(Equal(libsveltosv1alpha1.LogLevelInfo))
60+
})
7161
})

0 commit comments

Comments
 (0)