MCPcopy
hub / github.com/basecamp/once / TestContainerResources

Function TestContainerResources

integration/docker_test.go:868–890  ·  view source on GitHub ↗

Helpers

(t *testing.T)

Source from the content-addressed store, hash-verified

866// Helpers
867
868func TestContainerResources(t *testing.T) {
869 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
870 defer cancel()
871
872 ns, err := docker.NewNamespace("once-res-test")
873 require.NoError(t, err)
874 defer ns.Teardown(ctx, true)
875
876 require.NoError(t, ns.EnsureNetwork(ctx))
877 require.NoError(t, ns.Proxy().Boot(ctx, getProxyPorts(t)))
878
879 app := deployApp(t, ctx, ns, docker.ApplicationSettings{
880 Name: "campfire",
881 Image: "ghcr.io/basecamp/once-campfire:main",
882 Host: "campfire.localhost",
883 Resources: docker.ContainerResources{CPUs: 1, MemoryMB: 1024},
884 })
885
886 containerName, err := app.ContainerName(ctx)
887 require.NoError(t, err)
888
889 assertContainerResources(t, ctx, containerName, 1e9, 1024*1024*1024)
890}
891
892func deployApp(t *testing.T, ctx context.Context, ns *docker.Namespace, settings docker.ApplicationSettings) *docker.Application {
893 t.Helper()

Callers

nothing calls this directly

Calls 9

TeardownMethod · 0.95
EnsureNetworkMethod · 0.95
ProxyMethod · 0.95
NewNamespaceFunction · 0.92
getProxyPortsFunction · 0.85
deployAppFunction · 0.85
assertContainerResourcesFunction · 0.85
BootMethod · 0.80
ContainerNameMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…