add ImageFormat to worker_test and programs under contrib
Signed-off-by: Liang Chenye <liangchenye@huawei.com>
This commit is contained in:
parent
41509ccd3e
commit
4b11491067
@ -197,7 +197,7 @@ func history(imageName string) ([]string, error) {
|
||||
}
|
||||
|
||||
func analyzeLayer(endpoint, path, layerID, parentLayerID string) error {
|
||||
payload := struct{ ID, Path, ParentID string }{ID: layerID, Path: path, ParentID: parentLayerID}
|
||||
payload := struct{ ID, Path, ParentID, ImageFormat string }{ID: layerID, Path: path, ParentID: parentLayerID, ImageFormat: "Docker"}
|
||||
jsonPayload, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -51,6 +51,7 @@ type AddLayoutRequestAPI struct {
|
||||
ID string `json:"ID"`
|
||||
Path string `json:"Path"`
|
||||
ParantID string `json:"ParantID"`
|
||||
ImageFormat string `json:"ImageFormat"`
|
||||
}
|
||||
|
||||
type VulnerabilityItem struct {
|
||||
@ -223,7 +224,7 @@ func (clair ClairAPI) AddLayer(openvzMirror string, templateName string) error {
|
||||
client = httpClient
|
||||
}
|
||||
|
||||
jsonRequest, err := json.Marshal(AddLayoutRequestAPI{ID: templateName, Path: openvzMirror + "/" + templateName + ".tar.gz"})
|
||||
jsonRequest, err := json.Marshal(AddLayoutRequestAPI{ID: templateName, Path: openvzMirror + "/" + templateName + ".tar.gz", ImageFormat: "Docker"})
|
||||
if err != nil {
|
||||
log.Println("Cannot convert to json request with error: ", err)
|
||||
return err
|
||||
|
@ -26,9 +26,15 @@ func TestDistUpgrade(t *testing.T) {
|
||||
// blank.tar: MAINTAINER Quentin MACHU <quentin.machu.fr>
|
||||
// wheezy.tar: FROM debian:wheezy
|
||||
// jessie.tar: RUN sed -i "s/precise/trusty/" /etc/apt/sources.list && apt-get update && apt-get -y dist-upgrade
|
||||
assert.Nil(t, Process("blank", "", path+"blank.tar.gz", ""))
|
||||
assert.Nil(t, Process("wheezy", "blank", path+"wheezy.tar.gz", ""))
|
||||
assert.Nil(t, Process("jessie", "wheezy", path+"jessie.tar.gz", ""))
|
||||
assert.Nil(t, Process("blank", "", path+"blank.tar.gz", "Docker"))
|
||||
assert.Nil(t, Process("wheezy", "blank", path+"wheezy.tar.gz", "Docker"))
|
||||
assert.Nil(t, Process("jessie", "wheezy", path+"jessie.tar.gz", "Docker"))
|
||||
|
||||
err := Process("blank", "", path+"blank.tar.gz", "")
|
||||
assert.Error(t, err, "could not process a layer which does not have a specified format")
|
||||
|
||||
err = Process("blank", "", path+"blank.tar.gz", "invalid")
|
||||
assert.Error(t, err, "could not process a layer which does not have a supported format")
|
||||
|
||||
wheezy, err := database.FindOneLayerByID("wheezy", database.FieldLayerAll)
|
||||
if assert.Nil(t, err) {
|
||||
|
Loading…
Reference in New Issue
Block a user