acl: fix error type into a string type for serialization issue

acl_endpoint_test.go:507:
        	Error Trace:	acl_endpoint_test.go:507
        	            				retry.go:148
        	            				retry.go:149
        	            				retry.go:103
        	            				acl_endpoint_test.go:504
        	Error:      	Received unexpected error:
        	            	codec.decoder: decodeValue: Cannot decode non-nil codec value into nil error (1 methods)
        	Test:       	TestACLEndpoint_ReplicationStatus
pull/10612/head
Giulio Micheloni 3 years ago
parent 529fe737ef
commit 814ef6b103

@ -489,7 +489,7 @@ func (s *Server) updateACLReplicationStatusError(errorMsg error) {
defer s.aclReplicationStatusLock.Unlock()
s.aclReplicationStatus.LastError = time.Now().Round(time.Second).UTC()
s.aclReplicationStatus.LastErrorMessage = errorMsg
s.aclReplicationStatus.LastErrorMessage = errorMsg.Error()
}
func (s *Server) updateACLReplicationStatusIndex(replicationType structs.ACLReplicationType, index uint64) {

@ -1,7 +1,6 @@
package consul
import (
"errors"
"fmt"
"os"
"strconv"
@ -781,7 +780,7 @@ func TestACLReplication_TokensRedacted(t *testing.T) {
require.True(r, status.ReplicatedTokenIndex < token2.CreateIndex, "ReplicatedTokenIndex is not less than the token2s create index")
// ensures that token replication is erroring
require.True(r, status.LastError.After(minErrorTime), "Replication LastError not after the minErrorTime")
require.Equal(r, status.LastErrorMessage, errors.New("failed to retrieve unredacted tokens - replication token in use does not grant acl:write"))
require.Equal(r, status.LastErrorMessage, "failed to retrieve unredacted tokens - replication token in use does not grant acl:write")
})
}

@ -1269,7 +1269,7 @@ type ACLReplicationStatus struct {
ReplicatedTokenIndex uint64
LastSuccess time.Time
LastError time.Time
LastErrorMessage error
LastErrorMessage string
}
// ACLTokenSetRequest is used for token creation and update operations

Loading…
Cancel
Save