#!/usr/bin/perl # # tests for logformatter # (our $ME = $0) =~ s|^.*/||; use v5.14; use strict; use warnings; use FindBin; use File::Temp qw(tempdir); use Test::More; # To test links to source files $ENV{CIRRUS_CHANGE_IN_REPO} = 'ceci-nest-pas-une-sha'; # # Read the test cases (see __END__ section below) # my @tests; my $context = ''; while (my $line = ) { chomp $line; if ($line =~ /^==\s+(.*)/) { push @tests, { name => $1, input => [], expect => [] }; $context = ''; } elsif ($line =~ /^<<>>/) { $context = 'expect'; } elsif (@tests && $line) { push @{ $tests[-1]{$context} }, $line; } } plan tests => scalar(@tests); my $tempdir = tempdir("logformatter-test.XXXXXX", TMPDIR => 1, CLEANUP => !$ENV{DEBUG}); chdir $tempdir or die "$ME: Could not cd $tempdir: $!\n"; for my $t (@tests) { my $name = $t->{name}; (my $fname = $name) =~ s/\s+/_/g; open my $fh_out, '>', "$fname.txt" or die "$ME: Cannot create $tempdir/$fname.txt: $!\n"; print { $fh_out } "$_\n" for @{$t->{input}}; close $fh_out or die "$ME: Error writing $tempdir/$fname.txt: $!\n"; system("$FindBin::Bin/logformatter $fname <$fname.txt >/dev/null"); open my $fh_in, '<', "$fname.log.html" or die "$ME: Fatal: $fname: logformatter did not create .log.html\n"; my @actual; while (my $line = <$fh_in>) { chomp $line; push @actual, $line if $line =~ / begin processed output / .. $line =~ / end processed output /; } close $fh_in; # Strip off leading and trailing "
"
    shift @actual; pop @actual;

    # For debugging: preserve expected results
    if ($ENV{DEBUG}) {
        open my $fh_out, '>', "$fname.expect";
        print { $fh_out } "$_\n" for @{$t->{expect}};
        close $fh_out;
    }

    is_deeply \@actual, $t->{expect}, $name;
}

chdir '/';



__END__

== simple bats

<<<
1..4
ok 1 hi
ok 2 bye # skip no reason
not ok 3 fail
# $ /path/to/podman foo -bar
# #| FAIL: exit code is 123; expected 321
ok 4 blah
>>>
1..4
ok 1 hi
ok 2 bye # skip no reason
not ok 3 fail
# $ podman foo -bar
# #| FAIL: exit code is 123; expected 321
ok 4 blah

Summary: 2 Passed, 1 Failed, 1 Skipped. Total tests: 4 == simple ginkgo <<< $SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP} [08:26:19] START - All [+xxxx] lines that follow are relative to right now. [+0002s] GO111MODULE=on go build -mod=vendor -gcflags 'all=-trimpath=/var/tmp/go/src/github.com/containers/podman' -asmflags 'all=-trimpath=/var/tmp/go/src/github.com/containers/podman' -ldflags '-X github.com/containers/podman/libpod/define.gitCommit=40f5d8b1becd381c4e8283ed3940d09193e4fe06 -X github.com/containers/podman/libpod/define.buildInfo=1582809981 -X github.com/containers/podman/libpod/config._installPrefix=/usr/local -X github.com/containers/podman/libpod/config._etcDir=/etc -extldflags ""' -tags " selinux systemd exclude_graphdriver_devicemapper seccomp varlink" -o bin/podman github.com/containers/podman/cmd/podman [+0103s] • [+0103s] ------------------------------ [+0103s] Podman pod restart [+0103s] podman pod restart single empty pod [+0103s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:41 [+0103s] [BeforeEach] Podman pod restart [+0103s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:18 [+0103s] [It] podman pod restart single empty pod [+0103s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:41 [+0103s] Running: /var/tmp/go/src/github.com/containers/podman/bin/podman --storage-opt vfs.imagestore=/tmp/podman/imagecachedir --root /tmp/podman_test553496330/crio --runroot /tmp/podman_test553496330/crio-run --runtime /usr/bin/runc --conmon /usr/bin/conmon --network-config-dir /etc/cni/net.d --cgroup-manager systemd --tmpdir /tmp/podman_test553496330 --events-backend file --storage-driver vfs pod create --infra=false --share [+0103s] 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 [+0103s] output: 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 [+0103s] Running: /var/tmp/go/src/github.com/containers/podman/bin/podman --storage-opt vfs.imagestore=/tmp/podman/imagecachedir --root /tmp/podman_test553496330/crio --runroot /tmp/podman_test553496330/crio-run --runtime /usr/bin/runc --conmon /usr/bin/conmon --network-config-dir /etc/cni/net.d --cgroup-manager systemd --tmpdir /tmp/podman_test553496330 --events-backend file --storage-driver vfs pod restart 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 [+0103s] Error: no containers in pod 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 have no dependencies, cannot start pod: no such container [+0103s] output: [+0103s] [AfterEach] Podman pod restart [+0103s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:28 [+0103s] Running: /var/tmp/go/src/github.com/containers/podman/bin/podman --storage-opt vfs.imagestore=/tmp/podman/imagecachedir --root /tmp/podman_test553496330/crio --runroot /tmp/podman_test553496330/crio-run --runtime /usr/bin/runc --conmon /usr/bin/conmon --network-config-dir /etc/cni/net.d --cgroup-manager systemd --tmpdir /tmp/podman_test553496330 --events-backend file --storage-driver vfs pod rm -fa [+0103s] 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 [+0104s] Running: /var/tmp/go/src/github.com/containers/libpod/bin/podman-remote --storage-opt vfs.imagestore=/tmp/podman/imagecachedir --root /tmp/podman_test553496330/crio --runroot /tmp/podman_test553496330/crio-run --runtime /usr/bin/runc --conmon /usr/bin/conmon --network-config-dir /etc/cni/net.d --cgroup-manager systemd --tmpdir /tmp/podman_test553496330 --events-backend file --storage-driver vfs --remote --url unix:/run/user/12345/podman-xyz.sock pod rm -fa [+0104s] 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 again [+0107s] • [+0523s] ------------------------------ [+0523s] Podman play kube with build [+0523s] --build should override image in store [+0523s] /var/tmp/go/src/github.com/containers/podman/test/e2e/play_build_test.go:215 [+0479s] • [+0479s] ------------------------------ [+0479s] Podman pod rm [+0479s] podman pod rm -a doesn't remove a running container [+0479s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_rm_test.go:119 [+1405s] • [+1405s] ------------------------------ [+1405s] Podman run entrypoint [+1405s] podman run entrypoint == [""] [+1405s] /var/tmp/go/src/github.com/containers/podman/test/e2e/run_entrypoint_test.go:47 [+0184s] S [SKIPPING] [3.086 seconds] [+1385s] S [SKIPPING] in Spec Setup (BeforeEach) [0.001 seconds] [+1512s] Summarizing 6 Failures: [+1512s] [+1512s] [Fail] Podman play kube with build [It] --build should override image in store [+1512s] /var/tmp/go/src/github.com/containers/podman/test/e2e/play_build_test.go:259 >>> $SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP} [08:26:19] START - All [+xxxx] lines that follow are relative to right now. [+0002s] GO111MODULE=on go build -mod=vendor -gcflags 'all=-trimpath=/var/tmp/go/src/github.com/containers/podman' -asmflags 'all=-trimpath=/var/tmp/go/src/github.com/containers/podman' -ldflags '-X github.com/containers/podman/libpod/define.gitCommit=40f5d8b1becd381c4e8283ed3940d09193e4fe06 -X github.com/containers/podman/libpod/define.buildInfo=1582809981 -X github.com/containers/podman/libpod/config._installPrefix=/usr/local -X github.com/containers/podman/libpod/config._etcDir=/etc -extldflags ""' -tags " selinux systemd exclude_graphdriver_devicemapper seccomp varlink" -o bin/podman github.com/containers/podman/cmd/podman [+0103s]

[+0103s] Podman pod restart
         

podman pod restart single empty pod

/var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:41 [BeforeEach] Podman pod restart /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:18 [It] podman pod restart single empty pod /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:41 # podman [options] pod create --infra=false --share 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 # podman [options] pod restart 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 Error: no containers in pod 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 have no dependencies, cannot start pod: no such container output: [AfterEach] Podman pod restart /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_restart_test.go:28 # podman [options] pod rm -fa 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 [+0104s] # podman-remote [options] pod rm -fa 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 again [+0107s]

[+0523s] Podman play kube with build
         

--build should override image in store

/var/tmp/go/src/github.com/containers/podman/test/e2e/play_build_test.go:215 [+0479s]

[+0479s] Podman pod rm
         

podman pod rm -a doesn't remove a running container

/var/tmp/go/src/github.com/containers/podman/test/e2e/pod_rm_test.go:119 [+1405s]

[+1405s] Podman run entrypoint
         

podman run entrypoint == [""]

/var/tmp/go/src/github.com/containers/podman/test/e2e/run_entrypoint_test.go:47 [+0184s] S [SKIPPING] [3.086 seconds] [+1385s] S [SKIPPING] in Spec Setup (BeforeEach) [0.001 seconds] [+1512s] Summarizing 6 Failures: [+1512s] [Fail] Podman play kube with build [It] --build should override image in store /var/tmp/go/src/github.com/containers/podman/test/e2e/play_build_test.go:259 == simple python <<< [+0234s] env CONTAINERS_CONF=/var/tmp/go/src/github.com/containers/podman/test/apiv2/containers.conf PODMAN=./bin/podman /usr/bin/python3 -m unittest discover -v ./test/python/docker [+0238s] test_copy_to_container (compat.test_containers.TestContainers) ... /usr/lib/python3.10/site-packages/docker/utils/utils.py:269: DeprecationWarning: urllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() instead [+0238s] host, port = splitnport(parsed_url.netloc) [+0241s] ok [+0243s] test_create_container (compat.test_containers.TestContainers) ... ok [+0244s] test_create_network (compat.test_containers.TestContainers) ... ok [+0245s] test_filters (compat.test_containers.TestContainers) ... skipped 'TODO Endpoint does not yet support filters' [+0246s] test_kill_container (compat.test_containers.TestContainers) ... /usr/lib64/python3.10/threading.py:372: ResourceWarning: unclosed [+0246s] waiters_to_notify = _deque(_islice(all_waiters, n)) [+0246s] ResourceWarning: Enable tracemalloc to get the object allocation traceback [+0247s] ok [+0248s] test_list_container (compat.test_containers.TestContainers) ... ok [+0252s] test_mount_preexisting_dir (compat.test_containers.TestContainers) ... ok [+0253s] test_mount_rw_by_default (compat.test_containers.TestContainers) ... ok [+0257s] test_non_existant_workdir (compat.test_containers.TestContainers) ... ok [+0258s] test_pause_container (compat.test_containers.TestContainers) ... ok [+0260s] test_pause_stopped_container (compat.test_containers.TestContainers) ... ok [+0261s] test_remove_container (compat.test_containers.TestContainers) ... ok [+0262s] test_remove_container_without_force (compat.test_containers.TestContainers) ... /usr/lib64/python3.10/email/feedparser.py:89: ResourceWarning: unclosed [+0262s] for ateof in reversed(self._eofstack): [+0262s] ResourceWarning: Enable tracemalloc to get the object allocation traceback [+0262s] /usr/lib64/python3.10/email/feedparser.py:89: ResourceWarning: unclosed [+0262s] for ateof in reversed(self._eofstack): [+0262s] ResourceWarning: Enable tracemalloc to get the object allocation traceback [+0262s] ok [+0264s] test_restart_container (compat.test_containers.TestContainers) ... ok [+0265s] test_start_container (compat.test_containers.TestContainers) ... ok [+0267s] test_start_container_with_random_port_bind (compat.test_containers.TestContainers) ... ok [+0268s] test_stop_container (compat.test_containers.TestContainers) ... ok [+0269s] test_unpause_container (compat.test_containers.TestContainers) ... ok [+0273s] test_build_image (compat.test_images.TestImages) ... ok [+0273s] test_get_image_exists_not (compat.test_images.TestImages) [+0274s] Negative test for get image ... ok [+0274s] test_image_history (compat.test_images.TestImages) [+0274s] Image history ... ok [+0274s] test_list_images (compat.test_images.TestImages) [+0276s] List images ... ok [+0276s] test_load_corrupt_image (compat.test_images.TestImages) [+0277s] Import|Load Image failure ... ok [+0277s] test_load_image (compat.test_images.TestImages) [+0279s] Import|Load Image ... ok [+0279s] test_remove_image (compat.test_images.TestImages) [+0280s] Remove image ... ok [+0280s] test_retag_valid_image (compat.test_images.TestImages) [+0280s] Validates if name updates when the image is retagged ... ok [+0280s] test_save_image (compat.test_images.TestImages) [+0282s] Export Image ... ok [+0282s] test_search_bogus_image (compat.test_images.TestImages) [+0290s] Search for bogus image should throw exception ... ok [+0290s] test_search_image (compat.test_images.TestImages) [+0291s] Search for image ... FAIL [+0291s] test_tag_valid_image (compat.test_images.TestImages) [+0292s] Validates if the image is tagged successfully ... ok [+0296s] test_Info (compat.test_system.TestSystem) ... ok [+0298s] test_info_container_details (compat.test_system.TestSystem) ... ok [+0299s] test_version (compat.test_system.TestSystem) ... ok [+0299s] ====================================================================== [+0299s] FAIL: test_search_image (compat.test_images.TestImages) [+0299s] Search for image [+0299s] ---------------------------------------------------------------------- [+0299s] Traceback (most recent call last): [+0299s] File "/var/tmp/go/src/github.com/containers/podman/test/python/docker/compat/test_images.py", line 90, in test_search_image [+0299s] self.assertIn("alpine", r["Name"]) [+0299s] AssertionError: 'alpine' not found in 'docker.io/docker/desktop-kubernetes' [+0299s] ---------------------------------------------------------------------- [+0299s] Ran 33 tests in 63.138s [+0299s] FAILED (failures=1, skipped=1) [+0299s] make: *** [Makefile:616: localapiv2] Error 1 >>> [+0234s] env CONTAINERS_CONF=/var/tmp/go/src/github.com/containers/podman/test/apiv2/containers.conf PODMAN=./bin/podman /usr/bin/python3 -m unittest discover -v ./test/python/docker [+0238s] test_copy_to_container (compat.test_containers.TestContainers) ... /usr/lib/python3.10/site-packages/docker/utils/utils.py:269: DeprecationWarning: urllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() instead host, port = splitnport(parsed_url.netloc) [+0241s] ok [+0243s] test_create_container (compat.test_containers.TestContainers) ... ok [+0244s] test_create_network (compat.test_containers.TestContainers) ... ok [+0245s] test_filters (compat.test_containers.TestContainers) ... skipped 'TODO Endpoint does not yet support filters' [+0246s] test_kill_container (compat.test_containers.TestContainers) ... /usr/lib64/python3.10/threading.py:372: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 55054), raddr=('127.0.0.1', 8080)> waiters_to_notify = _deque(_islice(all_waiters, n)) ResourceWarning: Enable tracemalloc to get the object allocation traceback [+0247s] ok [+0248s] test_list_container (compat.test_containers.TestContainers) ... ok [+0252s] test_mount_preexisting_dir (compat.test_containers.TestContainers) ... ok [+0253s] test_mount_rw_by_default (compat.test_containers.TestContainers) ... ok [+0257s] test_non_existant_workdir (compat.test_containers.TestContainers) ... ok [+0258s] test_pause_container (compat.test_containers.TestContainers) ... ok [+0260s] test_pause_stopped_container (compat.test_containers.TestContainers) ... ok [+0261s] test_remove_container (compat.test_containers.TestContainers) ... ok [+0262s] test_remove_container_without_force (compat.test_containers.TestContainers) ... /usr/lib64/python3.10/email/feedparser.py:89: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 55068), raddr=('127.0.0.1', 8080)> for ateof in reversed(self._eofstack): ResourceWarning: Enable tracemalloc to get the object allocation traceback /usr/lib64/python3.10/email/feedparser.py:89: ResourceWarning: unclosed <socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 55074), raddr=('127.0.0.1', 8080)> for ateof in reversed(self._eofstack): ResourceWarning: Enable tracemalloc to get the object allocation traceback ok [+0264s] test_restart_container (compat.test_containers.TestContainers) ... ok [+0265s] test_start_container (compat.test_containers.TestContainers) ... ok [+0267s] test_start_container_with_random_port_bind (compat.test_containers.TestContainers) ... ok [+0268s] test_stop_container (compat.test_containers.TestContainers) ... ok [+0269s] test_unpause_container (compat.test_containers.TestContainers) ... ok [+0273s] test_build_image (compat.test_images.TestImages) ... ok test_get_image_exists_not (compat.test_images.TestImages) [+0274s] Negative test for get image ... ok test_image_history (compat.test_images.TestImages) Image history ... ok test_list_images (compat.test_images.TestImages) [+0276s] List images ... ok test_load_corrupt_image (compat.test_images.TestImages) [+0277s] Import|Load Image failure ... ok test_load_image (compat.test_images.TestImages) [+0279s] Import|Load Image ... ok test_remove_image (compat.test_images.TestImages) [+0280s] Remove image ... ok test_retag_valid_image (compat.test_images.TestImages) Validates if name updates when the image is retagged ... ok test_save_image (compat.test_images.TestImages) [+0282s] Export Image ... ok test_search_bogus_image (compat.test_images.TestImages) [+0290s] Search for bogus image should throw exception ... ok test_search_image (compat.test_images.TestImages) [+0291s] Search for image ... FAIL test_tag_valid_image (compat.test_images.TestImages) [+0292s] Validates if the image is tagged successfully ... ok [+0296s] test_Info (compat.test_system.TestSystem) ... ok [+0298s] test_info_container_details (compat.test_system.TestSystem) ... ok [+0299s] test_version (compat.test_system.TestSystem) ... ok
====================================================================== FAIL: test_search_image (compat.test_images.TestImages) Search for image ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/tmp/go/src/github.com/containers/podman/test/python/docker/compat/test_images.py", line 90, in test_search_image self.assertIn("alpine", r["Name"]) AssertionError: 'alpine' not found in 'docker.io/docker/desktop-kubernetes' ----------------------------------------------------------------------
Ran 33 tests in 63.138s FAILED (failures=1, skipped=1) make: *** [Makefile:616: localapiv2] Error 1
Summary: 28 Passed, 1 Failed, 1 Skipped. Total tests: 30 (WARNING: expected 33)