@@ -39,7 +39,7 @@ func TestACLEndpoint_BootstrapTokens(t *testing.T) {
39
39
waitForLeaderEstablishment (t , srv )
40
40
41
41
// Expect an error initially since ACL bootstrap is not initialized.
42
- arg := structs.DCSpecificRequest {
42
+ arg := structs.ACLInitialTokenBootstrapRequest {
43
43
Datacenter : "dc1" ,
44
44
}
45
45
var out structs.ACLToken
@@ -73,6 +73,53 @@ func TestACLEndpoint_BootstrapTokens(t *testing.T) {
73
73
require .Equal (t , out .CreateIndex , out .ModifyIndex )
74
74
}
75
75
76
+ func TestACLEndpoint_ProvidedBootstrapTokens (t * testing.T ) {
77
+ if testing .Short () {
78
+ t .Skip ("too slow for testing.Short" )
79
+ }
80
+
81
+ t .Parallel ()
82
+ _ , srv , codec := testACLServerWithConfig (t , func (c * Config ) {
83
+ // remove this as we are bootstrapping
84
+ c .ACLInitialManagementToken = ""
85
+ }, false )
86
+ waitForLeaderEstablishment (t , srv )
87
+
88
+ // Expect an error initially since ACL bootstrap is not initialized.
89
+ arg := structs.ACLInitialTokenBootstrapRequest {
90
+ Datacenter : "dc1" ,
91
+ BootstrapSecret : "2b778dd9-f5f1-6f29-b4b4-9a5fa948757a" ,
92
+ }
93
+ var out structs.ACLToken
94
+ require .NoError (t , msgpackrpc .CallWithCodec (codec , "ACL.BootstrapTokens" , & arg , & out ))
95
+ require .Equal (t , out .SecretID , arg .BootstrapSecret )
96
+ require .Equal (t , 36 , len (out .AccessorID ))
97
+ require .True (t , strings .HasPrefix (out .Description , "Bootstrap Token" ))
98
+ require .True (t , out .CreateIndex > 0 )
99
+ require .Equal (t , out .CreateIndex , out .ModifyIndex )
100
+ }
101
+
102
+ func TestACLEndpoint_ProvidedBootstrapTokensInvalid (t * testing.T ) {
103
+ if testing .Short () {
104
+ t .Skip ("too slow for testing.Short" )
105
+ }
106
+
107
+ t .Parallel ()
108
+ _ , srv , codec := testACLServerWithConfig (t , func (c * Config ) {
109
+ // remove this as we are bootstrapping
110
+ c .ACLInitialManagementToken = ""
111
+ }, false )
112
+ waitForLeaderEstablishment (t , srv )
113
+
114
+ // Expect an error initially since ACL bootstrap is not initialized.
115
+ arg := structs.ACLInitialTokenBootstrapRequest {
116
+ Datacenter : "dc1" ,
117
+ BootstrapSecret : "abc" ,
118
+ }
119
+ var out structs.ACLToken
120
+ require .EqualError (t , msgpackrpc .CallWithCodec (codec , "ACL.BootstrapTokens" , & arg , & out ), "uuid string is wrong length" )
121
+ }
122
+
76
123
func TestACLEndpoint_ReplicationStatus (t * testing.T ) {
77
124
if testing .Short () {
78
125
t .Skip ("too slow for testing.Short" )
0 commit comments