mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-06 16:08:29 +01:00
df241c0666
- use unified proxy handler to handle all the proxy traffic - define interfaces for the handlers - implement the interface at chart controller level - refactor UT cases - update other related reference code Signed-off-by: Steven Zou <szou@vmware.com>
33 lines
675 B
Go
33 lines
675 B
Go
package chartserver
|
|
|
|
import "testing"
|
|
|
|
// Test get /index.yaml
|
|
func TestGetIndexFile(t *testing.T) {
|
|
s, c, err := createMockObjects()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer s.Close()
|
|
|
|
namespaces := []string{"repo1", "repo2"}
|
|
indexFile, err := c.GetIndexFile(namespaces)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if len(indexFile.Entries) != 5 {
|
|
t.Fatalf("Expect index file with 5 entries, but got %d", len(indexFile.Entries))
|
|
}
|
|
|
|
_, ok := indexFile.Entries["repo1/harbor"]
|
|
if !ok {
|
|
t.Fatal("Expect chart entry 'repo1/harbor' but got nothing")
|
|
}
|
|
|
|
_, ok = indexFile.Entries["repo2/harbor"]
|
|
if !ok {
|
|
t.Fatal("Expect chart entry 'repo2/harbor' but got nothing")
|
|
}
|
|
}
|