Selaa lähdekoodia

integration: test more copy edge-cases

The existing archive implementation is not easy to reason about by
reading the source. Prepare to rewrite it by covering more edge cases in
tests. The new test cases were determined by black-box characterizing
the existing behaviour.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Cory Snider 2 vuotta sitten
vanhempi
commit
7d23c50599
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      integration/container/copy_test.go

+ 7 - 0
integration/container/copy_test.go

@@ -158,16 +158,23 @@ func TestCopyFromContainer(t *testing.T) {
 		expect map[string]string
 	}{
 		{"/", map[string]string{"/": "", "/foo": "hello", "/bar/quux/baz": "world", "/bar/filesymlink": "", "/bar/dirsymlink": "", "/bar/notarget": ""}},
+		{".", map[string]string{"./": "", "./foo": "hello", "./bar/quux/baz": "world", "./bar/filesymlink": "", "./bar/dirsymlink": "", "./bar/notarget": ""}},
+		{"/.", map[string]string{"./": "", "./foo": "hello", "./bar/quux/baz": "world", "./bar/filesymlink": "", "./bar/dirsymlink": "", "./bar/notarget": ""}},
+		{"./", map[string]string{"./": "", "./foo": "hello", "./bar/quux/baz": "world", "./bar/filesymlink": "", "./bar/dirsymlink": "", "./bar/notarget": ""}},
+		{"/./", map[string]string{"./": "", "./foo": "hello", "./bar/quux/baz": "world", "./bar/filesymlink": "", "./bar/dirsymlink": "", "./bar/notarget": ""}},
 		{"/bar/root", map[string]string{"root": ""}},
 		{"/bar/root/", map[string]string{"root/": "", "root/foo": "hello", "root/bar/quux/baz": "world", "root/bar/filesymlink": "", "root/bar/dirsymlink": "", "root/bar/notarget": ""}},
+		{"/bar/root/.", map[string]string{"./": "", "./foo": "hello", "./bar/quux/baz": "world", "./bar/filesymlink": "", "./bar/dirsymlink": "", "./bar/notarget": ""}},
 
 		{"bar/quux", map[string]string{"quux/": "", "quux/baz": "world"}},
 		{"bar/quux/", map[string]string{"quux/": "", "quux/baz": "world"}},
+		{"bar/quux/.", map[string]string{"./": "", "./baz": "world"}},
 		{"bar/quux/baz", map[string]string{"baz": "world"}},
 
 		{"bar/filesymlink", map[string]string{"filesymlink": ""}},
 		{"bar/dirsymlink", map[string]string{"dirsymlink": ""}},
 		{"bar/dirsymlink/", map[string]string{"dirsymlink/": "", "dirsymlink/baz": "world"}},
+		{"bar/dirsymlink/.", map[string]string{"./": "", "./baz": "world"}},
 		{"bar/notarget", map[string]string{"notarget": ""}},
 	} {
 		t.Run(x.src, func(t *testing.T) {