mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-25 18:18:04 +01:00
fix(chart,quota): fix path regexp of chart creation and deletion
Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
parent
3868d54b5c
commit
1d8eac8cf4
@ -29,8 +29,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
deleteChartVersionRe = regexp.MustCompile(`^/api/chartrepo/(?P<namespace>\w+)/charts/(?P<name>\w+)/(?P<version>[\w\d\.]+)/?$`)
|
deleteChartVersionRe = regexp.MustCompile(`^/api/chartrepo/(?P<namespace>[^?#]+)/charts/(?P<name>[^?#]+)/(?P<version>[^?#]+)/?$`)
|
||||||
createChartVersionRe = regexp.MustCompile(`^/api/chartrepo/(?P<namespace>\w+)/charts/?$`)
|
createChartVersionRe = regexp.MustCompile(`^/api/chartrepo/(?P<namespace>[^?#]+)/charts/?$`)
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -120,6 +120,21 @@ func (suite *HandlerSuite) TestUpload() {
|
|||||||
uploadChartVersion(projectID, projectName, "harbor", "0.2.0")
|
uploadChartVersion(projectID, projectName, "harbor", "0.2.0")
|
||||||
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
||||||
}, "repo1")
|
}, "repo1")
|
||||||
|
|
||||||
|
suite.WithProject(func(projectID int64, projectName string) {
|
||||||
|
uploadChartVersion(projectID, projectName, "harbor-ha", "dev")
|
||||||
|
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
||||||
|
}, "harbor-contrib")
|
||||||
|
|
||||||
|
suite.WithProject(func(projectID int64, projectName string) {
|
||||||
|
uploadChartVersion(projectID, projectName, "acs-engine-autoscaler", "1.0.0")
|
||||||
|
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
||||||
|
}, "cluster-autoscaler")
|
||||||
|
|
||||||
|
suite.WithProject(func(projectID int64, projectName string) {
|
||||||
|
uploadChartVersion(projectID, projectName, "123456", "1-0")
|
||||||
|
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
||||||
|
}, "123456")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *HandlerSuite) TestDelete() {
|
func (suite *HandlerSuite) TestDelete() {
|
||||||
@ -130,6 +145,30 @@ func (suite *HandlerSuite) TestDelete() {
|
|||||||
deleteChartVersion(projectName, "harbor", "0.2.1")
|
deleteChartVersion(projectName, "harbor", "0.2.1")
|
||||||
suite.AssertResourceUsage(0, types.ResourceCount, projectID)
|
suite.AssertResourceUsage(0, types.ResourceCount, projectID)
|
||||||
}, "repo1")
|
}, "repo1")
|
||||||
|
|
||||||
|
suite.WithProject(func(projectID int64, projectName string) {
|
||||||
|
uploadChartVersion(projectID, projectName, "harbor-ha", "dev")
|
||||||
|
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
||||||
|
|
||||||
|
deleteChartVersion(projectName, "harbor-ha", "dev")
|
||||||
|
suite.AssertResourceUsage(0, types.ResourceCount, projectID)
|
||||||
|
}, "harbor-contrib")
|
||||||
|
|
||||||
|
suite.WithProject(func(projectID int64, projectName string) {
|
||||||
|
uploadChartVersion(projectID, projectName, "acs-engine-autoscaler", "1.0.0")
|
||||||
|
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
||||||
|
|
||||||
|
deleteChartVersion(projectName, "acs-engine-autoscaler", "1.0.0")
|
||||||
|
suite.AssertResourceUsage(0, types.ResourceCount, projectID)
|
||||||
|
}, "cluster-autoscaler")
|
||||||
|
|
||||||
|
suite.WithProject(func(projectID int64, projectName string) {
|
||||||
|
uploadChartVersion(projectID, projectName, "123456", "1-0")
|
||||||
|
suite.AssertResourceUsage(1, types.ResourceCount, projectID)
|
||||||
|
|
||||||
|
deleteChartVersion(projectName, "123456", "1-0")
|
||||||
|
suite.AssertResourceUsage(0, types.ResourceCount, projectID)
|
||||||
|
}, "123456")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunHandlerSuite(t *testing.T) {
|
func TestRunHandlerSuite(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user