mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
AB#2032 Write IDs to disk and read when verifying (#212)
* AB#2032 Write IDs to disk and read when verifying * Update CHANGELOG.md * update changelog * update changelog * cli verify: prefer flag values * Rename fid file Co-authored-by: Thomas Tendyck <tt@edgeless.systems>
This commit is contained in:
parent
7cada2c9e8
commit
3177b2fdb7
9 changed files with 128 additions and 15 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -331,6 +332,13 @@ func TestWriteOutput(t *testing.T) {
|
|||
coordinatorPubIP: "baz-qq",
|
||||
kubeconfig: "foo-bar-baz-qq",
|
||||
}
|
||||
|
||||
expectedIdFile := clusterIDFile{
|
||||
Endpoint: result.coordinatorPubIP,
|
||||
ClusterID: result.clusterID,
|
||||
OwnerID: result.ownerID,
|
||||
}
|
||||
|
||||
var out bytes.Buffer
|
||||
testFs := afero.NewMemMapFs()
|
||||
fileHandler := file.NewHandler(testFs)
|
||||
|
@ -340,11 +348,20 @@ func TestWriteOutput(t *testing.T) {
|
|||
assert.Contains(out.String(), result.clientVpnIP)
|
||||
assert.Contains(out.String(), result.coordinatorPubIP)
|
||||
assert.Contains(out.String(), result.coordinatorPubKey)
|
||||
assert.Contains(out.String(), result.clusterID)
|
||||
assert.Contains(out.String(), result.ownerID)
|
||||
|
||||
afs := afero.Afero{Fs: testFs}
|
||||
adminConf, err := afs.ReadFile(constants.AdminConfFilename)
|
||||
assert.NoError(err)
|
||||
assert.Equal(result.kubeconfig, string(adminConf))
|
||||
|
||||
idsFile, err := afs.ReadFile(constants.IDsFileName)
|
||||
assert.NoError(err)
|
||||
var testIdFile clusterIDFile
|
||||
err = json.Unmarshal(idsFile, &testIdFile)
|
||||
assert.NoError(err)
|
||||
assert.Equal(expectedIdFile, testIdFile)
|
||||
}
|
||||
|
||||
func TestIpsToEndpoints(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue