diff --git a/cmd/internal/config/command.go b/cmd/internal/config/command.go deleted file mode 100644 index 67f5c7520901..000000000000 --- a/cmd/internal/config/command.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2018 The Jaeger Authors. -// -// 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 printconfig - -import ( - "fmt" - "sort" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -func Command(v *viper.Viper) *cobra.Command { - c := &cobra.Command{ - Use: "print-config", - Short: "Print configurations", - Long: `Iterates through the environment variables and prints them out`, - RunE: func(cmd *cobra.Command, args []string) error { - keys := v.AllKeys() - sort.Strings(keys) - for _, env := range keys { - value := v.Get(env) - str := fmt.Sprintf("%s=%v\n", env, value) - fmt.Fprint(cmd.OutOrStdout(), str) - } - return nil - }, - } - return c -} diff --git a/cmd/internal/config/command_test.go b/cmd/internal/config/command_test.go deleted file mode 100644 index 497a62389f7d..000000000000 --- a/cmd/internal/config/command_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2018 The Jaeger Authors. -// -// 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 printconfig - -import ( - "bytes" - "fmt" - "strings" - "testing" - - "github.com/spf13/viper" - "github.com/stretchr/testify/assert" - - "github.com/jaegertracing/jaeger/pkg/testutils" -) - -func TestCommand(t *testing.T) { - testPairs := []struct { - Key string - Value string - }{ - {"TEST_METRICS", "1"}, - {"TEST_REPORTER_LOG_SPANS", "true"}, - {"TEST_NUM_WORKS", "0"}, - } - - v := viper.New() - - v.SetDefault(testPairs[0].Key, testPairs[0].Value) - v.SetDefault(testPairs[1].Key, testPairs[1].Value) - v.SetDefault(testPairs[2].Key, testPairs[2].Value) - - buf := new(bytes.Buffer) - printCmd := Command(v) - printCmd.SetOut(buf) - printCmd.ExecuteC() - - output := buf.String() - - for _, pair := range testPairs { - - key := strings.ToLower(pair.Key) - value := strings.ToLower(pair.Value) - str := fmt.Sprintf("%s=%s", key, value) - - assert.Contains(t, output, str, "Output should contain the value '%s' for key '%s'", value, key) - } -} - -func TestMain(m *testing.M) { - testutils.VerifyGoLeaks(m) -} diff --git a/cmd/internal/config/config.go b/cmd/internal/config/config.go deleted file mode 100644 index a739d4d4a654..000000000000 --- a/cmd/internal/config/config.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2018 The Jaeger Authors. -// -// 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 print_config - -import ( - "fmt" - "sort" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -func Command(v *viper.Viper) *cobra.Command { - c := &cobra.Command{ - Use: "print-config", - Short: "Print configurations", - Long: `Iterates through the environment variables and prints them out`, - RunE: func(cmd *cobra.Command, args []string) error { - keys := v.AllKeys() - sort.Strings(keys) - for _, env := range keys { - value := v.Get(env) - str := fmt.Sprintf("%s=%v\n", env, value) - fmt.Fprintf(cmd.OutOrStdout(), str) - } - return nil - }, - } - return c -} diff --git a/cmd/internal/config/config_test.go b/cmd/internal/config/config_test.go deleted file mode 100644 index f72979d5a9b6..000000000000 --- a/cmd/internal/config/config_test.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2018 The Jaeger Authors. -// -// 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 print_config - -import ( - "bytes" - "fmt" - "strings" - "testing" - - "github.com/jaegertracing/jaeger/pkg/testutils" - "github.com/spf13/viper" - "github.com/stretchr/testify/assert" -) - -func TestCommand(t *testing.T) { - - testPairs := []struct { - Key string - Value string - }{ - {"TEST_METRICS", "1"}, - {"TEST_REPORTER_LOG_SPANS", "true"}, - {"TEST_NUM_WORKS", "0"}, - } - - v := viper.New() - - v.SetDefault(testPairs[0].Key, testPairs[0].Value) - v.SetDefault(testPairs[1].Key, testPairs[1].Value) - v.SetDefault(testPairs[2].Key, testPairs[2].Value) - - buf := new(bytes.Buffer) - printCmd := Command(v) - printCmd.SetOut(buf) - printCmd.ExecuteC() - - output := buf.String() - - for _, pair := range testPairs { - - key := strings.ToLower(pair.Key) - value := strings.ToLower(pair.Value) - str := fmt.Sprintf("%s=%s", key, value) - - assert.Contains(t, output, str, "Output should contain the value '%s' for key '%s'", value, key) - } - -} - -func TestMain(m *testing.M) { - testutils.VerifyGoLeaks(m) -}