@@ -531,3 +531,70 @@ spec:
531
531
run_podman pod rm -a -f
532
532
run_podman rm -a -f
533
533
}
534
+
535
+ @test " podman kube play - multi-pod YAML" {
536
+ skip_if_remote " service containers only work locally"
537
+ skip_if_journald_unavailable
538
+
539
+ # Create the YAMl file
540
+ yaml_source=" $PODMAN_TMPDIR /test.yaml"
541
+ cat > $yaml_source << EOF
542
+ apiVersion: v1
543
+ kind: Pod
544
+ metadata:
545
+ labels:
546
+ app: pod1
547
+ name: pod1
548
+ spec:
549
+ containers:
550
+ - command:
551
+ - top
552
+ image: $IMAGE
553
+ name: ctr1
554
+ ---
555
+ apiVersion: v1
556
+ kind: Pod
557
+ metadata:
558
+ labels:
559
+ app: pod2
560
+ name: pod2
561
+ spec:
562
+ containers:
563
+ - command:
564
+ - top
565
+ image: $IMAGE
566
+ name: ctr2
567
+ EOF
568
+ # Run `play kube` in the background as it will wait for the service
569
+ # container to exit.
570
+ timeout --foreground -v --kill=10 60 \
571
+ $PODMAN play kube --service-container=true --log-driver journald $yaml_source & > /dev/null &
572
+
573
+ # The name of the service container is predictable: the first 12 characters
574
+ # of the hash of the YAML file followed by the "-service" suffix
575
+ yaml_sha=$( sha256sum $yaml_source )
576
+ service_container=" ${yaml_sha: 0: 12} -service"
577
+ # Wait for the containers to be running
578
+ container_1=pod1-ctr1
579
+ container_2=pod1-ctr2
580
+ for i in $( seq 1 20) ; do
581
+ run_podman " ?" container wait $container_1 $container_2 $service_container --condition=" running"
582
+ if [[ $status == 0 ]]; then
583
+ break
584
+ fi
585
+ sleep 0.5
586
+ # Just for debugging
587
+ run_podman ps -a
588
+ done
589
+ if [[ $status != 0 ]]; then
590
+ die " container $container_1 , $container_2 and/or $service_container did not start"
591
+ fi
592
+
593
+ # Stop the pods, make sure that no ugly error logs show up and that the
594
+ # service container will implicitly get stopped as well
595
+ run_podman pod stop pod1 pod2
596
+ assert " $output " ! ~ " Stopping"
597
+ _ensure_container_running $service_container false
598
+
599
+ run_podman kube down $yaml_source
600
+ }
0 commit comments