@@ -86,6 +86,8 @@ const (
8686 ReadAheadCustomReadAheadKb = "15360"
8787 ReadAheadCustomMaxRatio = "100"
8888
89+ DisableAutoconfig = "disable-autoconfig"
90+
8991 GoogleCloudCliImage = "gcr.io/google.com/cloudsdktool/google-cloud-cli:slim"
9092 GolangImage = "golang:1.22.7"
9193 UbuntuImage = "ubuntu:20.04"
@@ -406,6 +408,15 @@ func (t *TestPod) GetNode() string {
406408 return t .pod .Spec .NodeName
407409}
408410
411+ func (t * TestPod ) GetMachineType (ctx context.Context ) (string , error ) {
412+ nodeName := t .GetNode ()
413+ node , err := t .client .CoreV1 ().Nodes ().Get (ctx , nodeName , metav1.GetOptions {})
414+ if err != nil {
415+ return "" , fmt .Errorf ("error getting test node %v's machine type " , nodeName )
416+ }
417+ return node .ObjectMeta .Labels ["node.kubernetes.io/instance-type" ], nil
418+ }
419+
409420func (t * TestPod ) GetCSIDriverNodePodIP (ctx context.Context ) string {
410421 node := t .GetNode ()
411422 daemonSetLabelSelector := "k8s-app=gcs-fuse-csi-driver"
@@ -1237,3 +1248,18 @@ func DeployIstioSidecar(namespace string) {
12371248func DeployIstioServiceEntry (namespace string ) {
12381249 e2ekubectl .RunKubectlOrDie (namespace , "apply" , "--filename" , "./specs/istio-service-entry.yaml" )
12391250}
1251+
1252+ func (t * TestPod ) VerifyDefaultingFlagsArePassed (namespace string , expectedMachineTypeFlag string , expectedDisableAutoconfigFlag bool ) {
1253+ stdout , stderr , err := e2ekubectl .RunKubectlWithFullOutput (namespace , "logs" , t .pod .Name , "-c" , "gke-gcsfuse-sidecar" )
1254+ framework .ExpectNoError (err ,
1255+ "Error accessing logs from pod %v, but failed with error message %q\n stdout: %s\n stderr: %s" ,
1256+ t .pod .Name , err , stdout , stderr )
1257+
1258+ expectedDisableAutoconfigFlagString := fmt .Sprintf (`"DisableAutoconfig":%t` , expectedDisableAutoconfigFlag )
1259+ expectedMachineTypeFlagString := fmt .Sprintf (`"MachineType":"%s"` , expectedMachineTypeFlag )
1260+
1261+ gomega .Expect (stdout ).To (gomega .ContainSubstring (expectedDisableAutoconfigFlagString ),
1262+ "Should find DisableAutoconfig flag string %q in stdout:\n %s" , expectedDisableAutoconfigFlagString , stdout )
1263+ gomega .Expect (stdout ).To (gomega .ContainSubstring (expectedMachineTypeFlagString ),
1264+ "Should find MachineType flag string %q in stdout:\n %s" , expectedMachineTypeFlagString , stdout )
1265+ }
0 commit comments