@@ -661,6 +661,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
661
661
662
662
def ' should create submit request with logs bucket PATH policy' () {
663
663
given :
664
+ def GCS_VOL = Volume . newBuilder(). setGcs(GCS . newBuilder(). setRemotePath(' foo' ). build() ). build()
664
665
def WORK_DIR = CloudStorageFileSystem . forBucket(' foo' ). getPath(' /scratch' )
665
666
def CONTAINER_IMAGE = ' ubuntu:22.1'
666
667
def LOGS_BUCKET = ' gs://my-logs-bucket/logs'
@@ -673,6 +674,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
673
674
def exec = Mock (GoogleBatchExecutor ) {
674
675
getSession() >> session
675
676
getBatchConfig() >> new BatchConfig ([logsBucket : LOGS_BUCKET ])
677
+ getConfig() >> Mock (ExecutorConfig )
676
678
isFusionEnabled() >> false
677
679
}
678
680
@@ -688,8 +690,9 @@ class GoogleBatchTaskHandlerTest extends Specification {
688
690
}
689
691
}
690
692
693
+ def LOGS_VOL = Volume . newBuilder(). setGcs(GCS . newBuilder(). setRemotePath(' my-logs-bucket' ). build()). setMountPath(' /mnt/disks/my-logs-bucket' ). build()
691
694
def mounts = [' /mnt/disks/foo/scratch:/mnt/disks/foo/scratch:rw' ]
692
- def volumes = [ GCS_VOL ]
695
+ def volumes = [ GCS_VOL , LOGS_VOL ]
693
696
def launcher = new GoogleBatchLauncherSpecMock (' bash .command.run' , mounts, volumes)
694
697
695
698
def handler = Spy (new GoogleBatchTaskHandler (task, exec))
@@ -705,9 +708,9 @@ class GoogleBatchTaskHandlerTest extends Specification {
705
708
req. getLogsPolicy(). getLogsPath() == ' /mnt/disks/my-logs-bucket/logs'
706
709
and :
707
710
def taskGroup = req. getTaskGroups(0 )
708
- def volumes = taskGroup. getTaskSpec(). getVolumesList()
709
- volumes . size() >= 2 // At least work dir volume and logs bucket volume
710
- def logsBucketVolume = volumes . find { it. getGcs(). getRemotePath() == ' my-logs-bucket' }
711
+ def taskVolumes = taskGroup. getTaskSpec(). getVolumesList()
712
+ taskVolumes . size() >= 2 // At least work dir volume and logs bucket volume
713
+ def logsBucketVolume = taskVolumes . find { it. getGcs(). getRemotePath() == ' my-logs-bucket' }
711
714
logsBucketVolume != null
712
715
logsBucketVolume. getMountPath() == ' /mnt/disks/my-logs-bucket'
713
716
}
0 commit comments