mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-10 10:15:03 -04:00
AB#2046 : Add option to create SSH users for the first coordinator upon initialization (#133)
* Move `file`, `ssh` and `user` packages to internal * Rename `SSHKey` to `(ssh.)UserKey` * Rename KeyValue / Publickey to PublicKey * Rename SSH key file from "debugd" to "ssh-keys" * Add CreateSSHUsers function to Core * Call CreateSSHUsers users on first control-plane node, when defined in config Tests: * Make StubUserCreator add entries to /etc/passwd * Add NewLinuxUserManagerFake for unit tests * Add unit tests & adjust existing ones to changes
This commit is contained in:
parent
5dc2e71d80
commit
68092f27dd
63 changed files with 879 additions and 554 deletions
36
internal/deploy/ssh/proto_test.go
Normal file
36
internal/deploy/ssh/proto_test.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package ssh
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestToAndFromProtoSlice(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
DemoSSHUser1 := UserKey{
|
||||
Username: "test-user-2",
|
||||
PublicKey: "ssh-rsa abcdefg",
|
||||
}
|
||||
|
||||
DemoSSHUser2 := UserKey{
|
||||
Username: "test-user-2",
|
||||
PublicKey: "ssh-rsa hijklmnop",
|
||||
}
|
||||
|
||||
// Input usually consists of pointers (from config parsing)
|
||||
DemoSSHUsersPointers := make([]*UserKey, 0)
|
||||
DemoSSHUsersPointers = append(DemoSSHUsersPointers, &DemoSSHUser1)
|
||||
DemoSSHUsersPointers = append(DemoSSHUsersPointers, &DemoSSHUser2)
|
||||
|
||||
// Expected output usually does not consist of pointers
|
||||
DemoSSHUsersNoPointers := make([]UserKey, 0)
|
||||
DemoSSHUsersNoPointers = append(DemoSSHUsersNoPointers, DemoSSHUser1)
|
||||
DemoSSHUsersNoPointers = append(DemoSSHUsersNoPointers, DemoSSHUser2)
|
||||
|
||||
ToProtoArray := ToProtoSlice(DemoSSHUsersPointers)
|
||||
FromProtoArray := FromProtoSlice(ToProtoArray)
|
||||
|
||||
assert.Equal(DemoSSHUsersNoPointers, FromProtoArray)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue