mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-02 20:16:15 -04:00
snp: don't print warning if no ASK is present (#3048)
Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com>
This commit is contained in:
parent
c1740b17d9
commit
002c6fa5a4
2 changed files with 15 additions and 6 deletions
|
@ -9,6 +9,7 @@ package snp
|
|||
import (
|
||||
"crypto/x509"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
@ -34,16 +35,13 @@ func TestParseCertChain(t *testing.T) {
|
|||
wantAsk bool
|
||||
wantArk bool
|
||||
wantErr bool
|
||||
errTarget error
|
||||
}{
|
||||
"success": {
|
||||
certChain: defaultCertChain,
|
||||
wantAsk: true,
|
||||
wantArk: true,
|
||||
},
|
||||
"empty cert chain": {
|
||||
certChain: []byte{},
|
||||
wantErr: true,
|
||||
},
|
||||
"more than two certificates": {
|
||||
certChain: append(defaultCertChain, defaultCertChain...),
|
||||
wantErr: true,
|
||||
|
@ -52,6 +50,11 @@ func TestParseCertChain(t *testing.T) {
|
|||
certChain: []byte("invalid"),
|
||||
wantErr: true,
|
||||
},
|
||||
"empty cert chain": {
|
||||
certChain: []byte{},
|
||||
wantErr: true,
|
||||
errTarget: errNoPemBlocks,
|
||||
},
|
||||
"ark missing": {
|
||||
certChain: []byte(askOnly),
|
||||
wantAsk: true,
|
||||
|
@ -73,6 +76,9 @@ func TestParseCertChain(t *testing.T) {
|
|||
ask, ark, err := instanceInfo.ParseCertChain()
|
||||
if tc.wantErr {
|
||||
assert.Error(err)
|
||||
if tc.errTarget != nil {
|
||||
assert.True(errors.Is(err, tc.errTarget))
|
||||
}
|
||||
} else {
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.wantAsk, ask != nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue