@@ -661,6 +661,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
661661
662662 def ' should create submit request with logs bucket PATH policy' () {
663663 given :
664+ def GCS_VOL = Volume . newBuilder(). setGcs(GCS . newBuilder(). setRemotePath(' foo' ). build() ). build()
664665 def WORK_DIR = CloudStorageFileSystem . forBucket(' foo' ). getPath(' /scratch' )
665666 def CONTAINER_IMAGE = ' ubuntu:22.1'
666667 def LOGS_BUCKET = ' gs://my-logs-bucket/logs'
@@ -673,6 +674,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
673674 def exec = Mock (GoogleBatchExecutor ) {
674675 getSession() >> session
675676 getBatchConfig() >> new BatchConfig ([logsBucket : LOGS_BUCKET ])
677+ getConfig() >> Mock (ExecutorConfig )
676678 isFusionEnabled() >> false
677679 }
678680
@@ -688,8 +690,9 @@ class GoogleBatchTaskHandlerTest extends Specification {
688690 }
689691 }
690692
693+ def LOGS_VOL = Volume . newBuilder(). setGcs(GCS . newBuilder(). setRemotePath(' my-logs-bucket' ). build()). setMountPath(' /mnt/disks/my-logs-bucket' ). build()
691694 def mounts = [' /mnt/disks/foo/scratch:/mnt/disks/foo/scratch:rw' ]
692- def volumes = [ GCS_VOL ]
695+ def volumes = [ GCS_VOL , LOGS_VOL ]
693696 def launcher = new GoogleBatchLauncherSpecMock (' bash .command.run' , mounts, volumes)
694697
695698 def handler = Spy (new GoogleBatchTaskHandler (task, exec))
@@ -705,9 +708,9 @@ class GoogleBatchTaskHandlerTest extends Specification {
705708 req. getLogsPolicy(). getLogsPath() == ' /mnt/disks/my-logs-bucket/logs'
706709 and :
707710 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' }
711714 logsBucketVolume != null
712715 logsBucketVolume. getMountPath() == ' /mnt/disks/my-logs-bucket'
713716 }
0 commit comments