Skip to content

Commit

Permalink
tests/lib/fakestore: return confinement in snap details
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
  • Loading branch information
bboozzoo committed Oct 29, 2018
1 parent a960454 commit 131723d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/lib/fakestore/store/store.go
Expand Up @@ -171,6 +171,7 @@ type essentialInfo struct {
Version string
Size uint64
Digest string
Confinement string
}

var errInfo = errors.New("cannot get info")
Expand Down Expand Up @@ -226,6 +227,7 @@ func snapEssentialInfo(w http.ResponseWriter, fn, snapID string, bs asserts.Back
Version: info.Version,
Digest: snapDigest,
Size: size,
Confinement: string(info.Confinement),
}, nil
}

Expand All @@ -244,6 +246,7 @@ type detailsReplyJSON struct {
Version string `json:"version"`
Revision int `json:"revision"`
DownloadDigest string `json:"download_sha3_384"`
Confinement string `json:"confinement"`
}

func (s *Store) searchEndpoint(w http.ResponseWriter, req *http.Request) {
Expand Down Expand Up @@ -293,6 +296,7 @@ func (s *Store) detailsEndpoint(w http.ResponseWriter, req *http.Request) {
Version: essInfo.Version,
Revision: essInfo.Revision,
DownloadDigest: hexify(essInfo.Digest),
Confinement: essInfo.Confinement,
}

// use indent because this is a development tool, output
Expand Down Expand Up @@ -429,6 +433,7 @@ func (s *Store) bulkEndpoint(w http.ResponseWriter, req *http.Request) {
Version: essInfo.Version,
Revision: essInfo.Revision,
DownloadDigest: hexify(essInfo.Digest),
Confinement: essInfo.Confinement,
})
}
}
Expand Down Expand Up @@ -523,8 +528,9 @@ type detailsResultV2 struct {
Sha3_384 string `json:"sha3-384"`
Size uint64 `json:"size"`
} `json:"download"`
Version string `json:"version"`
Revision int `json:"revision"`
Version string `json:"version"`
Revision int `json:"revision"`
Confinement string `json:"confinement"`
}

func (s *Store) snapActionEndpoint(w http.ResponseWriter, req *http.Request) {
Expand Down Expand Up @@ -606,6 +612,7 @@ func (s *Store) snapActionEndpoint(w http.ResponseWriter, req *http.Request) {
Name: essInfo.Name,
Version: essInfo.Version,
Revision: essInfo.Revision,
Confinement: essInfo.Confinement,
},
}
res.Snap.Publisher.ID = essInfo.DeveloperID
Expand Down

0 comments on commit 131723d

Please sign in to comment.