MCPcopy
hub / github.com/containerd/containerd / TestShimSockLength

Function TestShimSockLength

integration/client/container_test.go:1845–1896  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1843}
1844
1845func TestShimSockLength(t *testing.T) {
1846 t.Parallel()
1847
1848 // Max length of namespace should be 76
1849 namespace := strings.Repeat("n", 76)
1850
1851 ctx := namespaces.WithNamespace(t.Context(), namespace)
1852
1853 client, err := newClient(t, address)
1854 if err != nil {
1855 t.Fatal(err)
1856 }
1857 defer client.Close()
1858
1859 image, err := client.Pull(ctx, testImage,
1860 WithPlatformMatcher(platforms.Default()),
1861 WithPullUnpack,
1862 )
1863 if err != nil {
1864 t.Fatal(err)
1865 }
1866
1867 id := strings.Repeat("c", 64)
1868
1869 // We don't have limitation with length of container name,
1870 // but 64 bytes of sha256 is the common case
1871 container, err := client.NewContainer(ctx, id,
1872 WithNewSnapshot(id, image),
1873 WithNewSpec(oci.WithImageConfig(image), withExitStatus(0)),
1874 )
1875 if err != nil {
1876 t.Fatal(err)
1877 }
1878 defer container.Delete(ctx, WithSnapshotCleanup)
1879
1880 task, err := container.NewTask(ctx, empty())
1881 if err != nil {
1882 t.Fatal(err)
1883 }
1884 defer task.Delete(ctx)
1885
1886 statusC, err := task.Wait(ctx)
1887 if err != nil {
1888 t.Fatal(err)
1889 }
1890
1891 if err := task.Start(ctx); err != nil {
1892 t.Fatal(err)
1893 }
1894
1895 <-statusC
1896}
1897
1898func TestContainerExecLargeOutputWithTTY(t *testing.T) {
1899 if runtime.GOOS == "windows" {

Callers

nothing calls this directly

Calls 15

DeleteMethod · 0.95
NewTaskMethod · 0.95
WithNamespaceFunction · 0.92
WithImageConfigFunction · 0.92
newClientFunction · 0.85
WithPlatformMatcherFunction · 0.85
WithNewSpecFunction · 0.85
emptyFunction · 0.85
FatalMethod · 0.80
withExitStatusFunction · 0.70
CloseMethod · 0.65
PullMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…