get.porter.sh/porter@v1.3.0/pkg/config/logs_test.go (about)

     1  package config
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestParseLogLevel(t *testing.T) {
    10  	testcases := []struct {
    11  		value string
    12  		want  LogLevel
    13  	}{
    14  		{"debug", LogLevelDebug},
    15  		{"info", LogLevelInfo},
    16  		{"warn", LogLevelWarn},
    17  		{"warning", LogLevelWarn}, // Allow for our humanity
    18  		{"error", LogLevelError},
    19  	}
    20  	for _, tc := range testcases {
    21  		t.Run(tc.value, func(t *testing.T) {
    22  			lvl := ParseLogLevel(tc.value)
    23  			assert.Equalf(t, tc.want, lvl, "ParseLogLevel(%v)", tc.value)
    24  		})
    25  	}
    26  }