mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
update swagger, fix minor issues in test
This commit is contained in:
parent
282c7f61c4
commit
42bc430cfd
@ -1,5 +1,3 @@
|
|||||||
# this is an example of the Uber API
|
|
||||||
# as a demonstration of an API spec in YAML
|
|
||||||
swagger: '2.0'
|
swagger: '2.0'
|
||||||
info:
|
info:
|
||||||
title: Harbor API
|
title: Harbor API
|
||||||
@ -786,6 +784,32 @@ paths:
|
|||||||
description: Retrieved manifests from a relevant repository not found.
|
description: Retrieved manifests from a relevant repository not found.
|
||||||
500:
|
500:
|
||||||
description: Unexpected internal errors.
|
description: Unexpected internal errors.
|
||||||
|
/repositories/signatures:
|
||||||
|
get:
|
||||||
|
summary: Get signature information of a repository
|
||||||
|
description: |
|
||||||
|
This endpoint aims to retrieve signature information of a repository, the data is
|
||||||
|
from the nested notary instance of Harbor.
|
||||||
|
If the repository does not have any signature information in notary, this API will
|
||||||
|
return an empty list with response code 200, instead of 404
|
||||||
|
parameters:
|
||||||
|
- name: repo_name
|
||||||
|
in: query
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
description: repository name.
|
||||||
|
tags:
|
||||||
|
- Products
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: Retrieved signatures.
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/RepoSignature'
|
||||||
|
500:
|
||||||
|
description: Server side error.
|
||||||
|
|
||||||
/repositories/top:
|
/repositories/top:
|
||||||
get:
|
get:
|
||||||
summary: Get public repositories which are accessed most.
|
summary: Get public repositories which are accessed most.
|
||||||
@ -2025,3 +2049,12 @@ definitions:
|
|||||||
email_identity:
|
email_identity:
|
||||||
type: string
|
type: string
|
||||||
description: The dentity of email server.
|
description: The dentity of email server.
|
||||||
|
RepoSignature:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
tag:
|
||||||
|
type: string
|
||||||
|
description: The tag of image.
|
||||||
|
hashes:
|
||||||
|
type: object
|
||||||
|
description: The JSON object of the hash of the image.
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
notarytest "github.com/vmware/harbor/src/common/utils/notary/test"
|
notarytest "github.com/vmware/harbor/src/common/utils/notary/test"
|
||||||
|
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@ -16,7 +17,10 @@ func TestMain(m *testing.M) {
|
|||||||
defer notaryServer.Close()
|
defer notaryServer.Close()
|
||||||
notaryEndpoint = notaryServer.URL
|
notaryEndpoint = notaryServer.URL
|
||||||
notaryCachePath = "/tmp/notary"
|
notaryCachePath = "/tmp/notary"
|
||||||
m.Run()
|
result := m.Run()
|
||||||
|
if result != 0 {
|
||||||
|
os.Exit(result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetTargets(t *testing.T) {
|
func TestGetTargets(t *testing.T) {
|
||||||
|
@ -37,7 +37,6 @@ func NewNotaryServer(endpoint string) *httptest.Server {
|
|||||||
validRoot := fmt.Sprintf("/v2/%s/notary-demo/busybox/_trust/tuf/", endpoint)
|
validRoot := fmt.Sprintf("/v2/%s/notary-demo/busybox/_trust/tuf/", endpoint)
|
||||||
invalidRoot := fmt.Sprintf("/v2/%s/notary-demo/fail/_trust/tuf/", endpoint)
|
invalidRoot := fmt.Sprintf("/v2/%s/notary-demo/fail/_trust/tuf/", endpoint)
|
||||||
p := currPath()
|
p := currPath()
|
||||||
fmt.Printf("valid web root: %s, local path: %s\n", validRoot, path.Join(p, "valid"))
|
|
||||||
mux.Handle(validRoot, http.StripPrefix(validRoot, http.FileServer(http.Dir(path.Join(p, "valid")))))
|
mux.Handle(validRoot, http.StripPrefix(validRoot, http.FileServer(http.Dir(path.Join(p, "valid")))))
|
||||||
mux.Handle(invalidRoot, http.StripPrefix(invalidRoot, http.FileServer(http.Dir(path.Join(p, "invalid")))))
|
mux.Handle(invalidRoot, http.StripPrefix(invalidRoot, http.FileServer(http.Dir(path.Join(p, "invalid")))))
|
||||||
return httptest.NewServer(mux)
|
return httptest.NewServer(mux)
|
||||||
|
Loading…
Reference in New Issue
Block a user