113
113
import static oracle .kubernetes .operator .helpers .PodHelperTestBase .createSecretKeyRefEnvVar ;
114
114
import static oracle .kubernetes .operator .helpers .PodHelperTestBase .createSecurityContext ;
115
115
import static oracle .kubernetes .operator .helpers .PodHelperTestBase .createToleration ;
116
+ import static oracle .kubernetes .operator .helpers .StepContextConstants .FLUENTBIT_CONFIGMAP_VOLUME ;
116
117
import static oracle .kubernetes .operator .helpers .StepContextConstants .FLUENTD_CONFIGMAP_NAME_SUFFIX ;
118
+ import static oracle .kubernetes .operator .helpers .StepContextConstants .FLUENTD_CONFIGMAP_VOLUME ;
117
119
import static oracle .kubernetes .operator .helpers .StepContextConstants .FLUENTD_CONFIG_DATA_NAME ;
118
120
import static oracle .kubernetes .operator .helpers .StepContextConstants .FLUENTD_CONTAINER_NAME ;
119
121
import static oracle .kubernetes .operator .helpers .StepContextConstants .INIT_DOMAIN_ON_PV_CONTAINER ;
@@ -500,6 +502,46 @@ void whenFluentdWatchIntrospectLogsEnable_jobPodShouldHaveFluentdSidecar() {
500
502
501
503
}
502
504
505
+ @ Test
506
+ void whenFluentdWatchIntrospectLogsEnable_jobPodShouldHaveFluentdVolume () {
507
+ configureDomain ().withFluentdConfiguration (true , "dummy-cred" ,
508
+ null , null , null );
509
+
510
+ V1JobSpec jobSpec = createJobSpec ();
511
+
512
+ Optional <Object > list = Optional .ofNullable (jobSpec )
513
+ .map (V1JobSpec ::getTemplate )
514
+ .map (V1PodTemplateSpec ::getSpec )
515
+ .map (V1PodSpec ::getVolumes )
516
+ .map (c -> c .isEmpty () ? null : c .stream ().filter (v -> v .getName ()
517
+ .equals (FLUENTD_CONFIGMAP_VOLUME )).findAny ().orElse (null ));
518
+
519
+ assertThat (list , notNullValue ());
520
+
521
+ assertThat (list , not (Optional .empty ()));
522
+
523
+ }
524
+
525
+ @ Test
526
+ void whenFluentbitWatchIntrospectLogsEnable_jobPodShouldHaveFluentbitVolume () {
527
+ configureDomain ().withFluentbitConfiguration (true ,"dummy-cred" , "" ,
528
+ "" , null ,null );
529
+
530
+ V1JobSpec jobSpec = createJobSpec ();
531
+
532
+ Optional <Object > list = Optional .ofNullable (jobSpec )
533
+ .map (V1JobSpec ::getTemplate )
534
+ .map (V1PodTemplateSpec ::getSpec )
535
+ .map (V1PodSpec ::getVolumes )
536
+ .map (c -> c .isEmpty () ? null : c .stream ().filter (v -> v .getName ()
537
+ .equals (FLUENTBIT_CONFIGMAP_VOLUME )).findAny ().orElse (null ));
538
+
539
+ assertThat (list , notNullValue ());
540
+
541
+ assertThat (list , not (Optional .empty ()));
542
+
543
+ }
544
+
503
545
@ Test
504
546
void whenFluentdWatchIntrospectLogsDisable_jobPodShouldHaveFluentdSidecar () {
505
547
configureDomain ().withFluentdConfiguration (false , "dummy-cred" ,
@@ -516,6 +558,7 @@ void whenFluentdWatchIntrospectLogsDisable_jobPodShouldHaveFluentdSidecar() {
516
558
517
559
}
518
560
561
+
519
562
@ Test
520
563
void whenNoFluentdConfigmap_createIt () {
521
564
configureDomain ().withFluentdConfiguration (false , "dummy-cred" ,
0 commit comments