github.com/verrazzano/verrazzano@v1.7.1/cluster-operator/main_test.go (about) 1 // Copyright (c) 2022, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 package main 5 6 import ( 7 "os" 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 ) 12 13 // TestHandleFlags tests the handleFlags function 14 func TestHandleFlags(t *testing.T) { 15 asserts := assert.New(t) 16 17 // GIVEN command line arguments 18 // WHEN the handleFlags function is called 19 // THEN the command line flags are parsed correctly 20 const testCertDir = "/tmp/unit-test" 21 os.Args = []string{"cmd", "--cert-dir=" + testCertDir} 22 handleFlags() 23 24 asserts.Equal(testCertDir, certDir) 25 }