diff --git a/nkd_test.go b/nkd_test.go new file mode 100644 index 0000000000000000000000000000000000000000..95476db1cd4e89cec4da4c208b14d4311d2dead8 --- /dev/null +++ b/nkd_test.go @@ -0,0 +1,52 @@ +/* +Copyright 2024 KylinSoft Co., Ltd. + +Licensed 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 main + +import ( + "fmt" + "nestos-kubernetes-deployer/cmd/command/opts" + "testing" +) + +func TestNKD(t *testing.T) { + + t.Run("TestnewRootCmd", func(t *testing.T) { + cmd := newRootCmd() + + // Print command use and short description + fmt.Println("Command Use:", cmd.Use) + fmt.Println("Command Short Description:", cmd.Short) + }) + + t.Run("TestrunRootCmd", func(t *testing.T) { + cmd := newRootCmd() + testCases := []struct { + logLevel string + expected string + }{ + {"debug", "debug"}, + {"info", "info"}, + {"warn", "warn"}, + {"error", "error"}, + } + + for _, tc := range testCases { + opts.RootOpts.LogLevel = tc.logLevel + runRootCmd(cmd, []string{}) + fmt.Printf("Log Level set to: %s\n", tc.logLevel) + } + }) +}