Documentation ¶
Index ¶
- Variables
- type Suite
- func (suite *Suite) AddProject(ctx context.Context, project *proModels.Project) (int64, error)
- func (suite *Suite) Context() context.Context
- func (suite *Suite) DeleteProject(ctx context.Context, projectName string, projectID int64) error
- func (suite *Suite) Digest() digest.Digest
- func (suite *Suite) DigestString() string
- func (suite *Suite) ExecSQL(query string, args ...interface{})
- func (suite *Suite) IsNotFoundErr(err error) bool
- func (suite *Suite) NewRequest(method, target string, body io.Reader, queries ...map[string]string) *http.Request
- func (suite *Suite) NextHandler(statusCode int, headers map[string]string) http.Handler
- func (suite *Suite) RandString(n int, letters ...string) string
- func (suite *Suite) SetupSuite()
- func (suite *Suite) TearDownSuite()
- func (suite *Suite) WithProject(f func(int64, string), projectNames ...string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ChartListContent = []byte{} /* 1257 elements not displayed */
ChartListContent is the mock data of chart list
View Source
var HelmChartContent = []byte{} /* 17597 elements not displayed */
HelmChartContent is mock data of chart tgz...
View Source
var HelmChartProvContent = []byte{} /* 1269 elements not displayed */
HelmChartProvContent is mock data of chart tgz...
View Source
var MockChartRepoHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { hlog.Infof("Incoming testing request: %s", r.RequestURI) switch r.RequestURI { case "/health": if r.Method == http.MethodGet { mockStatus := make(map[string]interface{}) mockStatus["health"] = true data, _ := json.Marshal(mockStatus) w.Write(data) return } case "/repo1/index.yaml", "/library/index.yaml": if r.Method == http.MethodGet { w.Write([]byte(repo1IndexYaml)) return } case "/repo2/index.yaml": if r.Method == http.MethodGet { w.Write([]byte(repo2IndexYaml)) return } case "/not-existing-ns/index.yaml": if r.Method == http.MethodGet { w.WriteHeader(http.StatusNotFound) return } case "/repo1/charts/harbor-0.2.0.tgz", "/library/charts/harbor-0.2.0.tgz": if r.Method == http.MethodGet { w.Write(HelmChartContent) return } case "/repo1/charts/harbor-0.2.0.tgz.prov", "/library/charts/harbor-0.2.0.tgz.prov": if r.Method == http.MethodGet { w.Write(HelmChartProvContent) return } case "/api/repo1/charts", "/api/library/charts": if r.Method == http.MethodGet { w.Write(ChartListContent) return } case "/api/repo1/charts/harbor/0.2.0", "/api/library/charts/harbor/0.2.0": if r.Method == http.MethodGet { w.Write([]byte(harborChartV)) return } if r.Method == http.MethodDelete { w.WriteHeader(http.StatusOK) return } case "/api/repo1/charts/harbor/1.0.0": if r.Method == http.MethodGet { w.WriteHeader(http.StatusNotFound) w.Write([]byte("Not found")) return } case "/api/repo1/charts/harbor/0.2.1", "/api/library/charts/harbor/0.2.1": if r.Method == http.MethodDelete { w.WriteHeader(http.StatusOK) return } case "/api/repo1/charts/harbor": if r.Method == http.MethodGet { w.Write([]byte(chartVersionsOfHarbor)) return } case "/api/library/charts/harbor": if r.Method == http.MethodGet { w.Write([]byte(chartVersionsOfHarbor)) return } if r.Method == http.MethodDelete { w.WriteHeader(http.StatusOK) } case "/repo3/charts/harbor-0.8.1.tgz": if r.Method == http.MethodGet { w.WriteHeader(http.StatusUnauthorized) w.Write([]byte("Unauthorized")) return } case "/api/project_for_test_deletable/charts": if r.Method == http.MethodGet { w.Write([]byte("{}")) return } default: if r.Method == http.MethodGet { if strings.HasSuffix(r.RequestURI, "/index.yaml") { w.Write([]byte(repo2IndexYaml)) return } } } w.WriteHeader(http.StatusNotImplemented) w.Write([]byte("not supported")) })
MockChartRepoHandler is the backend chart server handler
Functions ¶
This section is empty.
Types ¶
type Suite ¶
Suite ...
func (*Suite) AddProject ¶
AddProject put here is to avoid import cycle
func (*Suite) DeleteProject ¶
DeleteProject put here is to avoid import cycle
func (*Suite) NewRequest ¶
func (suite *Suite) NewRequest(method, target string, body io.Reader, queries ...map[string]string) *http.Request
NewRequest ...
func (*Suite) NextHandler ¶
NextHandler ...
func (*Suite) RandString ¶
RandString ...
Click to show internal directories.
Click to hide internal directories.