@@ -68,6 +68,8 @@ func TestAddons(t *testing.T) {
68
68
args := append ([]string {"start" , "-p" , profile , "--wait=true" , "--memory=4000" , "--alsologtostderr" , "--addons=registry" , "--addons=metrics-server" , "--addons=volumesnapshots" , "--addons=csi-hostpath-driver" , "--addons=gcp-auth" }, StartArgs ()... )
69
69
if ! NoneDriver () { // none driver does not support ingress
70
70
args = append (args , "--addons=ingress" , "--addons=ingress-dns" )
71
+ } else if isOnAmazonEC2 , instanceType := detect .IsOnAmazonEC2 (); isOnAmazonEC2 && strings .HasPrefix (instanceType , "f1." ) {
72
+ args = append (args , "--addons=inaccel" ) // inaccel supports only none driver
71
73
}
72
74
if ! arm64Platform () {
73
75
args = append (args , "--addons=helm-tiller" )
@@ -95,6 +97,7 @@ func TestAddons(t *testing.T) {
95
97
{"HelmTiller" , validateHelmTillerAddon },
96
98
{"Olm" , validateOlmAddon },
97
99
{"CSI" , validateCSIDriverAndSnapshots },
100
+ {"InAccel" , validateInAccelAddon },
98
101
}
99
102
for _ , tc := range tests {
100
103
tc := tc
@@ -708,3 +711,40 @@ func validateGCPAuthAddon(ctx context.Context, t *testing.T, profile string) {
708
711
}
709
712
}
710
713
}
714
+
715
+ // validateInAccelAddon tests the inaccel addon by trying a vadd
716
+ func validateInAccelAddon (ctx context.Context , t * testing.T , profile string ) {
717
+ defer PostMortemLogs (t , profile )
718
+
719
+ if ! NoneDriver () {
720
+ t .Skipf ("skipping: inaccel not supported" )
721
+ }
722
+
723
+ if isOnAmazonEC2 , instanceType := detect .IsOnAmazonEC2 (); ! (isOnAmazonEC2 && strings .HasPrefix (instanceType , "f1." )) {
724
+ t .Skipf ("skipping: not running on an Amazon EC2 f1 instance" )
725
+ }
726
+
727
+ // create sample pod
728
+ rr , err := Run (t , exec .CommandContext (ctx , "kubectl" , "--context" , profile , "create" , "--filename" , filepath .Join (* testdataDir , "inaccel.yaml" )))
729
+ if err != nil {
730
+ t .Fatalf ("creating pod with %s failed: %v" , rr .Command (), err )
731
+ }
732
+
733
+ if _ , err = Run (t , exec .CommandContext (ctx , "kubectl" , "--context" , profile , "wait" , "--for" , "condition=ready" , "--timeout" , "-1s" , "pod/inaccel-vadd" )); err != nil {
734
+ t .Fatalf ("failed waiting for inaccel-vadd pod: %v" , err )
735
+ }
736
+
737
+ rr , err = Run (t , exec .CommandContext (ctx , "kubectl" , "--context" , profile , "logs" , "--follow" , "pod/inaccel-vadd" ))
738
+ if err != nil {
739
+ t .Fatalf ("%q failed: %v" , rr .Command (), err )
740
+ }
741
+ if ! strings .Contains (rr .Stdout .String (), "Test PASSED" ) {
742
+ t .Fatalf ("expected inaccel-vadd logs to include: %q but got: %s" , "Test PASSED" , rr .Output ())
743
+ }
744
+
745
+ // delete pod
746
+ rr , err = Run (t , exec .CommandContext (ctx , "kubectl" , "--context" , profile , "delete" , "pod/inaccel-vadd" ))
747
+ if err != nil {
748
+ t .Fatalf ("deleting pod with %s failed: %v" , rr .Command (), err )
749
+ }
750
+ }
0 commit comments