summaryrefslogtreecommitdiff
path: root/pkg/rootless/rootless_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-05 13:22:10 -0400
committerGitHub <noreply@github.com>2021-05-05 13:22:10 -0400
commit9d6588bc86d3325db7294c03a3ab27347364bb64 (patch)
treee3421dfda4017e60398c4b8c1e01c102ec8d2caa /pkg/rootless/rootless_test.go
parent120e1b78ef28e9220337423ea3e11486c813aa55 (diff)
parentc2c0d5058203070033b2d2e84c8b168bd4060650 (diff)
downloadpodman-9d6588bc86d3325db7294c03a3ab27347364bb64.tar.gz
podman-9d6588bc86d3325db7294c03a3ab27347364bb64.tar.bz2
podman-9d6588bc86d3325db7294c03a3ab27347364bb64.zip
Merge pull request #10223 from giuseppe/improve-rootless-automatic-range-split
rootless: improve automatic range split
Diffstat (limited to 'pkg/rootless/rootless_test.go')
-rw-r--r--pkg/rootless/rootless_test.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/pkg/rootless/rootless_test.go b/pkg/rootless/rootless_test.go
index ef574099c..fe9b23cdf 100644
--- a/pkg/rootless/rootless_test.go
+++ b/pkg/rootless/rootless_test.go
@@ -98,4 +98,61 @@ func TestMaybeSplitMappings(t *testing.T) {
if !reflect.DeepEqual(newMappings, desiredMappings) {
t.Fatal("wrong mappings generated")
}
+
+ mappings = []spec.LinuxIDMapping{
+ {
+ ContainerID: 0,
+ HostID: 0,
+ Size: 4,
+ },
+ }
+ desiredMappings = []spec.LinuxIDMapping{
+ {
+ ContainerID: 0,
+ HostID: 0,
+ Size: 1,
+ },
+ {
+ ContainerID: 1,
+ HostID: 1,
+ Size: 1,
+ },
+ {
+ ContainerID: 2,
+ HostID: 2,
+ Size: 1,
+ },
+ {
+ ContainerID: 3,
+ HostID: 3,
+ Size: 1,
+ },
+ }
+ availableMappings = []user.IDMap{
+ {
+ ID: 0,
+ ParentID: 0,
+ Count: 1,
+ },
+ {
+ ID: 1,
+ ParentID: 1,
+ Count: 1,
+ },
+ {
+ ID: 2,
+ ParentID: 2,
+ Count: 1,
+ },
+ {
+ ID: 3,
+ ParentID: 3,
+ Count: 1,
+ },
+ }
+
+ newMappings = MaybeSplitMappings(mappings, availableMappings)
+ if !reflect.DeepEqual(newMappings, desiredMappings) {
+ t.Fatal("wrong mappings generated")
+ }
}