mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-15 02:05:45 -04:00
implemented suggestions
This commit is contained in:
parent
ea94ebd236
commit
19181af13d
5 changed files with 40 additions and 9 deletions
|
@ -51,9 +51,6 @@ func TestClient(t *testing.T) {
|
||||||
{Role: role.ControlPlane, Name: "node-5", VPCIP: "192.0.2.3"},
|
{Role: role.ControlPlane, Name: "node-5", VPCIP: "192.0.2.3"},
|
||||||
}
|
}
|
||||||
caDerivationKey := make([]byte, 256)
|
caDerivationKey := make([]byte, 256)
|
||||||
for i := range caDerivationKey {
|
|
||||||
caDerivationKey[i] = 0x0
|
|
||||||
}
|
|
||||||
respCaKey := &joinproto.IssueJoinTicketResponse{EmergencyCaKey: caDerivationKey}
|
respCaKey := &joinproto.IssueJoinTicketResponse{EmergencyCaKey: caDerivationKey}
|
||||||
|
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
|
|
|
@ -205,6 +205,7 @@ go_test(
|
||||||
"@org_golang_google_grpc//:grpc",
|
"@org_golang_google_grpc//:grpc",
|
||||||
"@org_golang_google_grpc//codes",
|
"@org_golang_google_grpc//codes",
|
||||||
"@org_golang_google_grpc//status",
|
"@org_golang_google_grpc//status",
|
||||||
|
"@org_golang_x_crypto//ssh",
|
||||||
"@org_golang_x_mod//semver",
|
"@org_golang_x_mod//semver",
|
||||||
"@org_uber_go_goleak//:goleak",
|
"@org_uber_go_goleak//:goleak",
|
||||||
],
|
],
|
||||||
|
|
|
@ -2,6 +2,7 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||||
|
@ -10,6 +11,7 @@ import (
|
||||||
"github.com/spf13/afero"
|
"github.com/spf13/afero"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSSH(t *testing.T) {
|
func TestSSH(t *testing.T) {
|
||||||
|
@ -54,13 +56,13 @@ func TestSSH(t *testing.T) {
|
||||||
pubKey: someSSHPubKey,
|
pubKey: someSSHPubKey,
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
"malformatted public key": {
|
"malformed public key": {
|
||||||
fh: newFsWithDirectory(),
|
fh: newFsWithDirectory(),
|
||||||
pubKey: "asdf",
|
pubKey: "asdf",
|
||||||
masterSecret: someMasterSecret,
|
masterSecret: someMasterSecret,
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
"malformatted master secret": {
|
"malformed master secret": {
|
||||||
fh: newFsWithDirectory(),
|
fh: newFsWithDirectory(),
|
||||||
masterSecret: "asdf",
|
masterSecret: "asdf",
|
||||||
pubKey: someSSHPubKey,
|
pubKey: someSSHPubKey,
|
||||||
|
@ -91,6 +93,10 @@ func TestSSH(t *testing.T) {
|
||||||
assert.Error(err)
|
assert.Error(err)
|
||||||
} else {
|
} else {
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
cert, err := tc.fh.Read(fmt.Sprintf("%s/ca_cert.pub", constants.TerraformWorkingDir))
|
||||||
|
require.NoError(err)
|
||||||
|
_, _, _, _, err = ssh.ParseAuthorizedKey(cert)
|
||||||
|
require.NoError(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
19
e2e/miniconstellation/.terraform.lock.hcl
generated
19
e2e/miniconstellation/.terraform.lock.hcl
generated
|
@ -61,6 +61,25 @@ provider "registry.terraform.io/hashicorp/cloudinit" {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hashicorp/random" {
|
||||||
|
version = "3.6.3"
|
||||||
|
hashes = [
|
||||||
|
"h1:Fnaec9vA8sZ8BXVlN3Xn9Jz3zghSETIKg7ch8oXhxno=",
|
||||||
|
"zh:04ceb65210251339f07cd4611885d242cd4d0c7306e86dda9785396807c00451",
|
||||||
|
"zh:448f56199f3e99ff75d5c0afacae867ee795e4dfda6cb5f8e3b2a72ec3583dd8",
|
||||||
|
"zh:4b4c11ccfba7319e901df2dac836b1ae8f12185e37249e8d870ee10bb87a13fe",
|
||||||
|
"zh:4fa45c44c0de582c2edb8a2e054f55124520c16a39b2dfc0355929063b6395b1",
|
||||||
|
"zh:588508280501a06259e023b0695f6a18149a3816d259655c424d068982cbdd36",
|
||||||
|
"zh:737c4d99a87d2a4d1ac0a54a73d2cb62974ccb2edbd234f333abd079a32ebc9e",
|
||||||
|
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
|
||||||
|
"zh:a357ab512e5ebc6d1fda1382503109766e21bbfdfaa9ccda43d313c122069b30",
|
||||||
|
"zh:c51bfb15e7d52cc1a2eaec2a903ac2aff15d162c172b1b4c17675190e8147615",
|
||||||
|
"zh:e0951ee6fa9df90433728b96381fb867e3db98f66f735e0c3e24f8f16903f0ad",
|
||||||
|
"zh:e3cdcb4e73740621dabd82ee6a37d6cfce7fee2a03d8074df65086760f5cf556",
|
||||||
|
"zh:eff58323099f1bd9a0bec7cb04f717e7f1b2774c7d612bf7581797e1622613a0",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/tls" {
|
provider "registry.terraform.io/hashicorp/tls" {
|
||||||
version = "4.0.6"
|
version = "4.0.6"
|
||||||
constraints = "4.0.6"
|
constraints = "4.0.6"
|
||||||
|
|
|
@ -124,21 +124,29 @@ func TestGenerateRandomBytes(t *testing.T) {
|
||||||
|
|
||||||
func TestGenerateEmergencySSHCAKey(t *testing.T) {
|
func TestGenerateEmergencySSHCAKey(t *testing.T) {
|
||||||
nullKey := make([]byte, ed25519.SeedSize)
|
nullKey := make([]byte, ed25519.SeedSize)
|
||||||
for i := range nullKey {
|
|
||||||
nullKey[i] = 0x0
|
|
||||||
}
|
|
||||||
|
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
key []byte
|
key []byte
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
"invalid key": {
|
"key length = 0": {
|
||||||
key: make([]byte, 0),
|
key: make([]byte, 0),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
"valid key": {
|
"valid key": {
|
||||||
key: nullKey,
|
key: nullKey,
|
||||||
},
|
},
|
||||||
|
"nil input": {
|
||||||
|
key: nil,
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
|
"long key": {
|
||||||
|
key: make([]byte, 256),
|
||||||
|
},
|
||||||
|
"key too short": {
|
||||||
|
key: make([]byte, ed25519.SeedSize-1),
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, tc := range testCases {
|
for name, tc := range testCases {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue