mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-26 16:55:19 -04:00
api: for Azure attestationconfigapi use TCB values from SNP report instead of MAA token (#2429)
This commit is contained in:
parent
0c89f57ac5
commit
5819a11d25
11 changed files with 211 additions and 110 deletions
32
internal/api/attestationconfigapi/cli/main_test.go
Normal file
32
internal/api/attestationconfigapi/cli/main_test.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/verify"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAllEqual(t *testing.T) {
|
||||
// Test case 1: One input arg
|
||||
assert.True(t, allEqual(verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4}), "Expected allEqual to return true for one input arg, but got false")
|
||||
|
||||
// Test case 2: Three input args that are equal
|
||||
assert.True(t, allEqual(
|
||||
verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4},
|
||||
verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4},
|
||||
verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4},
|
||||
), "Expected allEqual to return true for three equal input args, but got false")
|
||||
|
||||
// Test case 3: Three input args where second and third element are different
|
||||
assert.False(t, allEqual(
|
||||
verify.TCBVersion{Bootloader: 2, Microcode: 2, SNP: 3, TEE: 4},
|
||||
verify.TCBVersion{Bootloader: 2, Microcode: 2, SNP: 3, TEE: 4},
|
||||
verify.TCBVersion{Bootloader: 2, Microcode: 3, SNP: 3, TEE: 4},
|
||||
), "Expected allEqual to return false for three input args with different second and third elements, but got true")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue