Feat: auto delete alias when unused
Some checks failed
Some checks failed
This commit is contained in:
@@ -13,7 +13,7 @@ var client *resty.Client
|
||||
func Test_00_Healthz(t *testing.T) {
|
||||
for i := 0; i < 10; i++ {
|
||||
resp, err := client.R().
|
||||
Get("http://localhost:8080/healthz")
|
||||
Get("/healthz")
|
||||
if err == nil && resp.StatusCode() == http.StatusOK {
|
||||
return
|
||||
}
|
||||
@@ -24,4 +24,5 @@ func Test_00_Healthz(t *testing.T) {
|
||||
|
||||
func init() {
|
||||
client = resty.New()
|
||||
client.SetBaseURL("http://localhost:8080")
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@ func Test_03_PutImageAliases(t *testing.T) {
|
||||
}
|
||||
resp, err := client.R().
|
||||
SetBody(payload).
|
||||
Put(fmt.Sprintf("http://localhost:8080/api/image/%d/aliases",
|
||||
image.Id))
|
||||
Put(fmt.Sprintf("/api/image/%d/aliases", image.Id))
|
||||
if err != nil || resp.StatusCode() != http.StatusOK {
|
||||
t.Logf("%+v", resp)
|
||||
t.Fatal("failed to put image alias")
|
||||
@@ -45,11 +44,24 @@ func Test_03_PutImageAliases(t *testing.T) {
|
||||
}
|
||||
resp, err := client.R().
|
||||
SetBody(payload).
|
||||
Put(fmt.Sprintf("http://localhost:8080/api/image/%d/aliases",
|
||||
image.Id))
|
||||
Put(fmt.Sprintf("/api/image/%d/aliases", image.Id))
|
||||
if err != nil || resp.StatusCode() != http.StatusOK {
|
||||
t.Logf("%+v", resp)
|
||||
t.Fatal("failed to put image alias")
|
||||
}
|
||||
|
||||
resp, err = client.R().
|
||||
SetResult(&aliases).
|
||||
Get("/api/aliases")
|
||||
if err != nil || resp.StatusCode() != http.StatusOK {
|
||||
t.Logf("%+v", resp)
|
||||
t.Fatal("failed to get aliases")
|
||||
}
|
||||
|
||||
for _, alias := range aliases {
|
||||
if alias.Name == "testalias2" {
|
||||
t.Fatal("alias should be deleted")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user