From 6dccf36d9407e64572e5047df6c52b42b65349d2 Mon Sep 17 00:00:00 2001 From: mfordjody <11638005@qq.com> Date: Wed, 30 Oct 2024 12:00:54 +0800 Subject: [PATCH] [dubboctl] fix test errors v3 --- dubboctl/cmd/common.go | 26 ++++++++++++++++++++++++++ dubboctl/cmd/manifest_test.go | 9 +++++---- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 dubboctl/cmd/common.go diff --git a/dubboctl/cmd/common.go b/dubboctl/cmd/common.go new file mode 100644 index 000000000..5fa60c672 --- /dev/null +++ b/dubboctl/cmd/common.go @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "sigs.k8s.io/controller-runtime/pkg/client" +) + +var ( + // TestInstallFlag and TestCli are uses for black box testing + TestInstallFlag bool + TestCli client.Client +) diff --git a/dubboctl/cmd/manifest_test.go b/dubboctl/cmd/manifest_test.go index 64cdafa49..1787f44fd 100644 --- a/dubboctl/cmd/manifest_test.go +++ b/dubboctl/cmd/manifest_test.go @@ -18,6 +18,7 @@ package cmd import ( "bytes" "os" + "sigs.k8s.io/controller-runtime/pkg/client/fake" "strings" "testing" ) @@ -97,8 +98,8 @@ func TestManifestInstall(t *testing.T) { }, } // For now, we do not use envTest to do black box testing - //TestInstallFlag = true - //TestCli = fake.NewClientBuilder().Build() + TestInstallFlag = true + TestCli = fake.NewClientBuilder().Build() for _, test := range tests { t.Run(test.desc, func(t *testing.T) { @@ -122,8 +123,8 @@ func TestManifestUninstall(t *testing.T) { }, } // For now, we do not use envTest to do black box testing - //TestInstallFlag = true - //TestCli = fake.NewClientBuilder().Build() + TestInstallFlag = true + TestCli = fake.NewClientBuilder().Build() for _, test := range tests { t.Run(test.desc, func(t *testing.T) {