[OOM-CERT-SERVICE] Add Certification Request functionality
[oom/platform/cert-service.git] / certServiceK8sExternalProvider / main_test.go
index d74fe0d..83420d6 100644 (file)
 package main
 
 import (
+       "flag"
        "os"
        "testing"
+
        "github.com/stretchr/testify/assert"
-       "flag"
 )
 
 func Test_shouldParseArguments_defaultValues(t *testing.T) {
-       os.Args = []string {
+       os.Args = []string{
                "first-arg-is-omitted-by-method-parse-arguments-so-this-only-a-placeholder"}
        flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
 
-       metricsAddr, enableLeaderElection := parseInputArguments()
+       metricsAddr, logLevel, enableLeaderElection := parseInputArguments()
 
        assert.Equal(t, ":8080", metricsAddr)
+       assert.Equal(t, "debug", logLevel)
        assert.False(t, enableLeaderElection)
 }
 
 func Test_shouldParseArguments_valuesFromCLI(t *testing.T) {
-       os.Args = []string {
+       os.Args = []string{
                "first-arg-is-omitted-by-method-parse-arguments-so-this-only-a-placeholder",
                "--metrics-addr=127.0.0.1:555",
-               "--enable-leader-election=true" }
+               "--log-level=error",
+               "--enable-leader-election=true"}
        flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
 
-       metricsAddr, enableLeaderElection := parseInputArguments()
+       metricsAddr, logLevel, enableLeaderElection := parseInputArguments()
 
        assert.Equal(t, "127.0.0.1:555", metricsAddr)
+       assert.Equal(t, "error", logLevel)
        assert.True(t, enableLeaderElection)
-
 }