@@ -644,7 +644,13 @@ func TestCalculateAirgapStorageSpace(t *testing.T) {
644
644
name : "controller node with 500MB uncompressed size" ,
645
645
uncompressedSize : 500 * 1024 * 1024 , // 500MB
646
646
isController : true ,
647
- expected : "1Gi" , // 2x = 1GB, rounded up
647
+ expected : "1000Mi" , // 2x
648
+ },
649
+ {
650
+ name : "controller node with 500MB uncompressed size" ,
651
+ uncompressedSize : 512 * 1024 * 1024 , // 500MB
652
+ isController : true ,
653
+ expected : "1Gi" , // 2x
648
654
},
649
655
{
650
656
name : "worker node with 500MB uncompressed size" ,
@@ -685,69 +691,3 @@ func TestCalculateAirgapStorageSpace(t *testing.T) {
685
691
})
686
692
}
687
693
}
688
-
689
- func TestTemplateAirgapStorageSpaceChecks (t * testing.T ) {
690
- tests := []struct {
691
- name string
692
- controllerAirgapStorageSpace string
693
- workerAirgapStorageSpace string
694
- expectControllerCheck bool
695
- expectWorkerCheck bool
696
- }{
697
- {
698
- name : "controller node check" ,
699
- controllerAirgapStorageSpace : "2Gi" ,
700
- workerAirgapStorageSpace : "" ,
701
- expectControllerCheck : true ,
702
- expectWorkerCheck : false ,
703
- },
704
- {
705
- name : "worker node check" ,
706
- controllerAirgapStorageSpace : "" ,
707
- workerAirgapStorageSpace : "1Gi" ,
708
- expectControllerCheck : false ,
709
- expectWorkerCheck : true ,
710
- },
711
- {
712
- name : "no airgap checks" ,
713
- controllerAirgapStorageSpace : "" ,
714
- workerAirgapStorageSpace : "" ,
715
- expectControllerCheck : false ,
716
- expectWorkerCheck : false ,
717
- },
718
- }
719
-
720
- for _ , tt := range tests {
721
- t .Run (tt .name , func (t * testing.T ) {
722
- data := types.TemplateData {
723
- ControllerAirgapStorageSpace : tt .controllerAirgapStorageSpace ,
724
- WorkerAirgapStorageSpace : tt .workerAirgapStorageSpace ,
725
- }
726
-
727
- hpfs , err := GetClusterHostPreflights (context .Background (), data )
728
- require .NoError (t , err )
729
- require .Len (t , hpfs , 1 )
730
-
731
- spec := hpfs [0 ].Spec
732
- specStr , err := json .Marshal (spec )
733
- require .NoError (t , err )
734
- specStrLower := strings .ToLower (string (specStr ))
735
-
736
- if tt .expectControllerCheck {
737
- require .Contains (t , specStrLower , "airgap storage space" )
738
- require .Contains (t , specStrLower , "controller" )
739
- require .NotContains (t , specStrLower , "worker airgap storage space" )
740
- } else {
741
- require .NotContains (t , specStrLower , "airgap storage space" )
742
- }
743
-
744
- if tt .expectWorkerCheck {
745
- require .Contains (t , specStrLower , "worker airgap storage space" )
746
- require .Contains (t , specStrLower , "infrastructure images" )
747
- require .NotContains (t , specStrLower , "airgap storage space" )
748
- } else {
749
- require .NotContains (t , specStrLower , "worker airgap storage space" )
750
- }
751
- })
752
- }
753
- }
0 commit comments