mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 14:26:23 -04:00
api: refactor attestationconfigapi client/fetcher
There is now one SEVSNPVersions type that has a variant property. That property is used to build the correct JSON path. The surrounding methods handling the version objects are also updated to receive a variant argument and work for multiple variants. This simplifies adding AWS support.
This commit is contained in:
parent
5542f9c63c
commit
350397923f
16 changed files with 411 additions and 262 deletions
|
@ -11,8 +11,8 @@ import (
|
|||
)
|
||||
|
||||
func TestIsInputNewerThanLatestAPI(t *testing.T) {
|
||||
newTestCfg := func() AzureSEVSNPVersion {
|
||||
return AzureSEVSNPVersion{
|
||||
newTestCfg := func() SEVSNPVersion {
|
||||
return SEVSNPVersion{
|
||||
Microcode: 93,
|
||||
TEE: 0,
|
||||
SNP: 6,
|
||||
|
@ -21,13 +21,13 @@ func TestIsInputNewerThanLatestAPI(t *testing.T) {
|
|||
}
|
||||
|
||||
testCases := map[string]struct {
|
||||
latest AzureSEVSNPVersion
|
||||
input AzureSEVSNPVersion
|
||||
latest SEVSNPVersion
|
||||
input SEVSNPVersion
|
||||
expect bool
|
||||
errMsg string
|
||||
}{
|
||||
"input is older than latest": {
|
||||
input: func(c AzureSEVSNPVersion) AzureSEVSNPVersion {
|
||||
input: func(c SEVSNPVersion) SEVSNPVersion {
|
||||
c.Microcode--
|
||||
return c
|
||||
}(newTestCfg()),
|
||||
|
@ -36,7 +36,7 @@ func TestIsInputNewerThanLatestAPI(t *testing.T) {
|
|||
errMsg: "input Microcode version: 92 is older than latest API version: 93",
|
||||
},
|
||||
"input has greater and smaller version field than latest": {
|
||||
input: func(c AzureSEVSNPVersion) AzureSEVSNPVersion {
|
||||
input: func(c SEVSNPVersion) SEVSNPVersion {
|
||||
c.Microcode++
|
||||
c.Bootloader--
|
||||
return c
|
||||
|
@ -46,7 +46,7 @@ func TestIsInputNewerThanLatestAPI(t *testing.T) {
|
|||
errMsg: "input Bootloader version: 1 is older than latest API version: 2",
|
||||
},
|
||||
"input is newer than latest": {
|
||||
input: func(c AzureSEVSNPVersion) AzureSEVSNPVersion {
|
||||
input: func(c SEVSNPVersion) SEVSNPVersion {
|
||||
c.TEE++
|
||||
return c
|
||||
}(newTestCfg()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue