Ejemplo n.º 1
0
func init() {
	if reexec.Init() {
		os.Exit(0)
	}

	maxId := uint32(sysinfo.Min(sysinfo.MustGetMaxValidUID(), sysinfo.MustGetMaxValidGID()))
	idMappings = rootfs_provider.MappingList{
		{
			ContainerID: 0,
			HostID:      maxId,
			Size:        1,
		},
		{
			ContainerID: 1,
			HostID:      1,
			Size:        maxId - 1,
		},
	}
}
Ejemplo n.º 2
0
					var err error
					container, err = client.Create(garden.ContainerSpec{
						RootFSPath: "docker:///cfgarden/empty#v0.1.0",
						Handle:     imageID,
						Privileged: privileged,
					})
					Expect(err).ToNot(HaveOccurred())
				})

				AfterEach(func() {
					client.Destroy(container.Handle())
				})

				It("executes plugin create with the correct args", func() {
					maxId := uint32(sysinfo.Min(sysinfo.MustGetMaxValidUID(), sysinfo.MustGetMaxValidGID()))
					userArgsStr, err := ioutil.ReadFile(filepath.Join(imagePath, "create-args"))
					Expect(err).ToNot(HaveOccurred())

					userArgs := strings.Split(string(userArgsStr), " ")
					Expect(userArgs).To(Equal([]string{
						testImagePluginBin,
						"create",
						"--uid-mapping",
						fmt.Sprintf("0:%d:1", maxId),
						"--gid-mapping",
						fmt.Sprintf("0:%d:1", maxId),
						"--uid-mapping",
						fmt.Sprintf("1:1:%d", maxId-1),
						"--gid-mapping",
						fmt.Sprintf("1:1:%d", maxId-1),