Skip to content

Commit

Permalink
HSM Functional Tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mauricio Harley <[email protected]>
  • Loading branch information
xek authored and Mauricio Harley committed Dec 9, 2024
1 parent 5e42c75 commit 6cbb57c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/functional/barbican_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ var _ = Describe("Barbican controller", func() {
})

It("Should have the right configuration contents", func() {
keystone.SimulateKeystoneEndpointReady(barbicanTest.BarbicanKeystoneEndpoint)
/*keystone.SimulateKeystoneEndpointReady(barbicanTest.BarbicanKeystoneEndpoint)
mariadb.SimulateMariaDBAccountCompleted(barbicanTest.BarbicanDatabaseAccount)
mariadb.SimulateMariaDBDatabaseCompleted(barbicanTest.BarbicanDatabaseName)
mariadb.SimulateMariaDBDatabaseCompleted(barbicanTest.BarbicanDatabaseName)*/

cf := th.GetSecret(barbicanTest.BarbicanConfigSecret)
Expect(cf).ShouldNot(BeNil())
Expand Down
11 changes: 10 additions & 1 deletion tests/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func GetHSMBarbicanAPISpec() map[string]interface{} {
"pkcs11": map[string]interface{}{
"type": HSMType,
"libraryPath": HSMLibraryPath,
"slotId": HSMSlotId,
"slotId": HSMSlotID,
"MKEKLabel": HSMMKEKLabel,
"HMACLabel": HSMHMACLabel,
"serverAddress": HSMServerAddress,
Expand All @@ -214,6 +214,15 @@ func GetHSMBarbicanAPISpec() map[string]interface{} {
return spec
}

func CreateHSMLoginSecret(namespace string, name string) *corev1.Secret {
return th.CreateSecret(
types.NamespacedName{Namespace: namespace, Name: name},
map[string][]byte{
"hsmLogin": []byte("12345678"),
},
)
}

// ========== End of HSM Stuff ============

func GetDefaultBarbicanAPISpec() map[string]interface{} {
Expand Down
17 changes: 8 additions & 9 deletions tests/functional/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ const (
interval = time.Millisecond * 200

// HSM Constants
HSMSecret = "hsm-secret"
HSMType = "luna" // Using them Luna model without any specific selection criteria.
HSMLibraryPath = "/usr/local/luna/libs/64/libCryptoki2.so"
HSMSlotId = "1"
HSMMKEKLabel = "MKEKLabel"
HSMHMACLabel = "HMACLabel"
HSMServerAddress = "192.168.0.1"
HSMClientAddress = "192.168.0.2"
HSMLoginSecret = "dummy-secret"
HSMType = "luna" // Using them Luna model without any specific selection criteria.
HSMLibraryPath = "/usr/local/luna/libs/64/libCryptoki2.so"
HSMSlotID = "1"
HSMMKEKLabel = "MKEKLabel"
HSMHMACLabel = "HMACLabel"
HSMServerAddress = "192.168.0.1"
HSMClientAddress = "192.168.0.2"
HSMLoginSecret = "hsm-secret"
)

func TestAPIs(t *testing.T) {
Expand Down

0 comments on commit 6cbb57c

Please sign in to comment.