TestIssue13030 is a regression test for parallel image unpacking. The test validates that when multiple layers are unpacked in parallel, that whiteout files are properly processed and do not cause files to be unexpectedly present in the final rootfs. https://github.com/containerd/containerd/issues/
(t *testing.T)
| 1822 | // |
| 1823 | // https://github.com/containerd/containerd/issues/13030 |
| 1824 | func TestIssue13030(t *testing.T) { |
| 1825 | client, err := newClient(t, address) |
| 1826 | if err != nil { |
| 1827 | t.Fatal(err) |
| 1828 | } |
| 1829 | t.Cleanup(func() { client.Close() }) |
| 1830 | |
| 1831 | ctx, cancel := testContext(t) |
| 1832 | t.Cleanup(cancel) |
| 1833 | |
| 1834 | image, err := client.Pull(ctx, |
| 1835 | images.Get(images.Whiteout), |
| 1836 | WithPlatformMatcher(platforms.Default()), |
| 1837 | WithPullUnpack, |
| 1838 | WithUnpackOpts([]UnpackOpt{WithUnpackLimiter(semaphore.NewWeighted(3))}), |
| 1839 | ) |
| 1840 | t.Cleanup(func() { |
| 1841 | client.ImageService().Delete(ctx, images.Get(images.Whiteout)) |
| 1842 | }) |
| 1843 | if err != nil { |
| 1844 | t.Fatal(err) |
| 1845 | } |
| 1846 | |
| 1847 | container, err := client.NewContainer(ctx, t.Name(), |
| 1848 | WithNewSnapshot(t.Name(), image), |
| 1849 | WithNewSpec(oci.WithImageConfig(image), |
| 1850 | withProcessArgs("/bin/sh", "-e", "-c", "test ! -e /file-to-delete && test ! -e /dir-to-delete")), |
| 1851 | ) |
| 1852 | if err != nil { |
| 1853 | t.Fatal(err) |
| 1854 | } |
| 1855 | t.Cleanup(func() { |
| 1856 | container.Delete(ctx, WithSnapshotCleanup) |
| 1857 | }) |
| 1858 | |
| 1859 | task, err := container.NewTask(ctx, empty()) |
| 1860 | if err != nil { |
| 1861 | t.Fatal(err) |
| 1862 | } |
| 1863 | t.Cleanup(func() { |
| 1864 | task.Delete(ctx) |
| 1865 | }) |
| 1866 | |
| 1867 | statusC, err := task.Wait(ctx) |
| 1868 | if err != nil { |
| 1869 | t.Fatal(err) |
| 1870 | } |
| 1871 | err = task.Start(ctx) |
| 1872 | if err != nil { |
| 1873 | t.Fatal(err) |
| 1874 | } |
| 1875 | status := <-statusC |
| 1876 | code, _, err := status.Result() |
| 1877 | if err != nil { |
| 1878 | t.Fatal(err) |
| 1879 | } |
| 1880 | if code != 0 { |
| 1881 | t.Errorf("expected status 0 from wait but received %d", code) |
nothing calls this directly
no test coverage detected
searching dependent graphs…