mirror of https://github.com/status-im/consul.git
Regenerate files according to 1.19.2 formatter
This commit is contained in:
parent
0aaf49fed7
commit
bde57c0dd0
|
@ -63,7 +63,6 @@ func IsErrPermissionDenied(err error) bool {
|
|||
|
||||
// Arguably this should be some sort of union type.
|
||||
// The usage of Cause and the rest of the fields is entirely disjoint.
|
||||
//
|
||||
type PermissionDeniedError struct {
|
||||
Cause string
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ func (ac *AutoConfig) introToken() (string, error) {
|
|||
|
||||
// recordInitialConfiguration is responsible for recording the AutoConfigResponse from
|
||||
// the AutoConfig.InitialConfiguration RPC. It is an all-in-one function to do the following
|
||||
// * update the Agent token in the token store
|
||||
// - update the Agent token in the token store
|
||||
func (ac *AutoConfig) recordInitialConfiguration(resp *pbautoconf.AutoConfigResponse) error {
|
||||
ac.autoConfigResponse = resp
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package cachetype
|
|||
// RPC is an interface that an RPC client must implement. This is a helper
|
||||
// interface that is implemented by the agent delegate so that Type
|
||||
// implementations can request RPC access.
|
||||
//
|
||||
//go:generate mockery --name RPC --inpackage
|
||||
type RPC interface {
|
||||
RPC(method string, args interface{}, reply interface{}) error
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
//
|
||||
// This interface is typically implemented by request structures in
|
||||
// the agent/structs package.
|
||||
//
|
||||
//go:generate mockery --name Request --inpackage
|
||||
type Request interface {
|
||||
// CacheInfo returns information used for caching this request.
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
)
|
||||
|
||||
// Type implements the logic to fetch certain types of data.
|
||||
//
|
||||
//go:generate mockery --name Type --inpackage
|
||||
type Type interface {
|
||||
// Fetch fetches a single unique item.
|
||||
|
|
|
@ -47,7 +47,7 @@ type FileWatcherEvent struct {
|
|||
Filenames []string
|
||||
}
|
||||
|
||||
//NewFileWatcher create a file watcher that will watch all the files/folders from configFiles
|
||||
// NewFileWatcher create a file watcher that will watch all the files/folders from configFiles
|
||||
// if success a fileWatcher will be returned and a nil error
|
||||
// otherwise an error and a nil fileWatcher are returned
|
||||
func NewFileWatcher(configFiles []string, logger hclog.Logger) (Watcher, error) {
|
||||
|
|
|
@ -6,8 +6,11 @@ import (
|
|||
)
|
||||
|
||||
// KindName is a value type useful for maps. You can use:
|
||||
//
|
||||
// map[KindName]Payload
|
||||
//
|
||||
// instead of:
|
||||
//
|
||||
// map[string]map[string]Payload
|
||||
type KindName struct {
|
||||
Kind string
|
||||
|
|
|
@ -45,6 +45,7 @@ func CompactUID() (string, error) {
|
|||
// specific purpose.
|
||||
//
|
||||
// Format is:
|
||||
//
|
||||
// {provider}-{uniqueID_first8}.{pri|sec}.ca.<trust_domain_first_8>.consul
|
||||
//
|
||||
// trust domain is truncated to keep the whole name short
|
||||
|
|
|
@ -225,6 +225,7 @@ type ACLResolverSettings struct {
|
|||
// - Resolving roles remotely via an ACL.RoleResolve RPC
|
||||
//
|
||||
// Remote Resolution:
|
||||
//
|
||||
// Remote resolution can be done synchronously or asynchronously depending
|
||||
// on the ACLDownPolicy in the Config passed to the resolver.
|
||||
//
|
||||
|
@ -237,7 +238,6 @@ type ACLResolverSettings struct {
|
|||
// However in this mode channels are created to receive the results of the RPC
|
||||
// and are registered with the resolver. Those channels are immediately read/blocked
|
||||
// upon.
|
||||
//
|
||||
type ACLResolver struct {
|
||||
config ACLResolverSettings
|
||||
logger hclog.Logger
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
"github.com/armon/go-metrics/prometheus"
|
||||
"github.com/hashicorp/go-bexpr"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
memdb "github.com/hashicorp/go-memdb"
|
||||
uuid "github.com/hashicorp/go-uuid"
|
||||
"github.com/hashicorp/go-memdb"
|
||||
"github.com/hashicorp/go-uuid"
|
||||
|
||||
"github.com/hashicorp/consul/acl"
|
||||
"github.com/hashicorp/consul/acl/resolver"
|
||||
|
@ -120,7 +120,6 @@ type ACL struct {
|
|||
// Q: Why is the reset index not in the config?
|
||||
// A: We want to be able to remove the reset index once we have used it. This prevents
|
||||
// accidentally allowing bootstrapping yet again after a snapshot restore.
|
||||
//
|
||||
func (a *ACL) fileBootstrapResetIndex() uint64 {
|
||||
// Determine the file path to check
|
||||
path := filepath.Join(a.srv.config.DataDir, aclBootstrapReset)
|
||||
|
|
|
@ -27,7 +27,6 @@ import (
|
|||
//
|
||||
// - POST /apis/authentication.k8s.io/v1/tokenreviews
|
||||
// - GET /api/v1/namespaces/<NAMESPACE>/serviceaccounts/<NAME>
|
||||
//
|
||||
type TestAPIServer struct {
|
||||
srv *httptest.Server
|
||||
caCert string
|
||||
|
|
|
@ -14,9 +14,9 @@ import (
|
|||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/armon/go-metrics/prometheus"
|
||||
connlimit "github.com/hashicorp/go-connlimit"
|
||||
"github.com/hashicorp/go-connlimit"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
memdb "github.com/hashicorp/go-memdb"
|
||||
"github.com/hashicorp/go-memdb"
|
||||
"github.com/hashicorp/go-raftchunking"
|
||||
"github.com/hashicorp/memberlist"
|
||||
"github.com/hashicorp/raft"
|
||||
|
@ -1142,7 +1142,7 @@ func (s *Server) consistentRead() error {
|
|||
defer metrics.MeasureSince([]string{"rpc", "consistentRead"}, time.Now())
|
||||
future := s.raft.VerifyLeader()
|
||||
if err := future.Error(); err != nil {
|
||||
return err //fail fast if leader verification fails
|
||||
return err // fail fast if leader verification fails
|
||||
}
|
||||
// poll consistent read readiness, wait for up to RPCHoldTimeout milliseconds
|
||||
if s.isReadyForConsistentReads() {
|
||||
|
@ -1197,13 +1197,13 @@ func (s *Server) rpcQueryTimeout(queryTimeout time.Duration) time.Duration {
|
|||
//
|
||||
// Notes:
|
||||
//
|
||||
// * The definition of "unauthenticated" here is incomplete, as it doesn't
|
||||
// - The definition of "unauthenticated" here is incomplete, as it doesn't
|
||||
// account for the fact that operators can modify the anonymous token with
|
||||
// custom policies, or set namespace default policies. As these scenarios
|
||||
// are less common and this flag is a best-effort UX improvement, we think
|
||||
// the trade-off for reduced complexity is acceptable.
|
||||
//
|
||||
// * This method assumes that the given token has already been validated (and
|
||||
// - This method assumes that the given token has already been validated (and
|
||||
// will only check whether it is blank or not). It's a safe assumption because
|
||||
// ResultsFilteredByACLs is only set to try when applying the already-resolved
|
||||
// token's policies.
|
||||
|
|
|
@ -76,7 +76,6 @@ func verifyCheckServiceNodeSort(t *testing.T, nodes structs.CheckServiceNodes, e
|
|||
// node3 node2 node5 node4 node1
|
||||
// | | | | | | | | | | |
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 (ms)
|
||||
//
|
||||
func seedCoordinates(t *testing.T, codec rpc.ClientCodec, server *Server) {
|
||||
// Register some nodes.
|
||||
for i := 0; i < 5; i++ {
|
||||
|
|
|
@ -1267,8 +1267,8 @@ func (s *Store) ServicesByNodeMeta(ws memdb.WatchSet, filters map[string]string,
|
|||
// The service_last_extinction is set to the last raft index when a service
|
||||
// was unregistered (or 0 if no services were ever unregistered). This
|
||||
// allows blocking queries to
|
||||
// * return when the last instance of a service is removed
|
||||
// * block until an instance for this service is available, or another
|
||||
// - return when the last instance of a service is removed
|
||||
// - block until an instance for this service is available, or another
|
||||
// service is unregistered.
|
||||
func maxIndexForService(tx ReadTxn, serviceName string, serviceExists, checks bool, entMeta *acl.EnterpriseMeta, peerName string) uint64 {
|
||||
idx, _ := maxIndexAndWatchChForService(tx, serviceName, serviceExists, checks, entMeta, peerName)
|
||||
|
@ -1280,8 +1280,8 @@ func maxIndexForService(tx ReadTxn, serviceName string, serviceExists, checks bo
|
|||
// index. The service_last_extinction is set to the last raft index when a
|
||||
// service was unregistered (or 0 if no services were ever unregistered). This
|
||||
// allows blocking queries to
|
||||
// * return when the last instance of a service is removed
|
||||
// * block until an instance for this service is available, or another
|
||||
// - return when the last instance of a service is removed
|
||||
// - block until an instance for this service is available, or another
|
||||
// service is unregistered.
|
||||
//
|
||||
// It also _may_ return a watch chan to add to a WatchSet. It will only return
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
memdb "github.com/hashicorp/go-memdb"
|
||||
"github.com/hashicorp/go-memdb"
|
||||
|
||||
"github.com/hashicorp/consul/acl"
|
||||
"github.com/hashicorp/consul/agent/configentry"
|
||||
|
@ -65,6 +65,7 @@ func configIntentionsConvertToList(iter memdb.ResultIterator, _ *acl.EnterpriseM
|
|||
// found in a list of exported-services config entries. For OSS, namespace is not considered, so a match is one of:
|
||||
// - the service name matches
|
||||
// - the service name is a wildcard
|
||||
//
|
||||
// This value can be used to filter exported-services config entries for a given service name.
|
||||
func getExportedServicesMatchServiceNames(serviceName string, entMeta *acl.EnterpriseMeta) []structs.ServiceName {
|
||||
return []structs.ServiceName{
|
||||
|
|
|
@ -16,7 +16,6 @@ import (
|
|||
// data is deleted from the KV store, the "latest" row can go backwards if the
|
||||
// newest row is removed. The tombstones provide a way to ensure time doesn't
|
||||
// move backwards within some interval.
|
||||
//
|
||||
type TombstoneGC struct {
|
||||
// ttl sets the TTL for tombstones.
|
||||
ttl time.Duration
|
||||
|
|
|
@ -102,7 +102,6 @@ func noopDone() {}
|
|||
// 2. Any channels added to the memdb.WatchSet should only unblock when the
|
||||
// results returned by the query have changed. This might be difficult
|
||||
// to do when blocking on non-existent data.
|
||||
//
|
||||
func ServerLocalBlockingQuery[ResultType any, StoreType StateStore](
|
||||
ctx context.Context,
|
||||
getStore func() StoreType,
|
||||
|
|
|
@ -7,12 +7,13 @@ import (
|
|||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/armon/go-metrics/prometheus"
|
||||
"github.com/hashicorp/consul/agent/consul/state"
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/lib/retry"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-memdb"
|
||||
"golang.org/x/time/rate"
|
||||
|
||||
"github.com/hashicorp/consul/agent/consul/state"
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/lib/retry"
|
||||
)
|
||||
|
||||
var StatsGauges = []prometheus.GaugeDefinition{
|
||||
|
@ -132,7 +133,6 @@ func (c *Controller) updateDrainRateLimit(numProxies uint32) {
|
|||
// 0-512 proxies: drain 1 per second
|
||||
// 513-2815 proxies: linearly scaled by 1/s for every additional 256 proxies
|
||||
// 2816+ proxies: drain 10 per second
|
||||
//
|
||||
func calcRateLimit(numProxies uint32) rate.Limit {
|
||||
perSecond := math.Floor((float64(numProxies) - 256) / 256)
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
)
|
||||
|
||||
// Client interface exposes HCP operations that can be invoked by Consul
|
||||
//
|
||||
//go:generate mockery --name Client --with-expecter --inpackage
|
||||
type Client interface {
|
||||
FetchBootstrap(ctx context.Context) (*BootstrapConfig, error)
|
||||
|
|
|
@ -33,7 +33,6 @@ package agent
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -791,21 +790,7 @@ var translateServiceIDTCs = []translateKeyTestCase{
|
|||
},
|
||||
}
|
||||
|
||||
// ACLPolicySetRequest:
|
||||
// Policy structs.ACLPolicy
|
||||
// ID string
|
||||
// Name string
|
||||
// Description string
|
||||
// Rules string
|
||||
// Syntax acl.SyntaxVersion
|
||||
// Datacenters []string
|
||||
// Hash []uint8
|
||||
// RaftIndex structs.RaftIndex
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// Datacenter string
|
||||
// WriteRequest structs.WriteRequest
|
||||
// Token string
|
||||
// structs.ACLPolicySetRequest
|
||||
func TestDecodeACLPolicyWrite(t *testing.T) {
|
||||
|
||||
for _, tc := range hashTestCases {
|
||||
|
@ -833,35 +818,7 @@ func TestDecodeACLPolicyWrite(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// ACLTokenSetRequest:
|
||||
// ACLToken structs.ACLToken
|
||||
// AccessorID string
|
||||
// SecretID string
|
||||
// Description string
|
||||
// Policies []structs.ACLTokenPolicyLink
|
||||
// ID string
|
||||
// Name string
|
||||
// Roles []structs.ACLTokenRoleLink
|
||||
// ID string
|
||||
// Name string
|
||||
// ServiceIdentities []*structs.ACLServiceIdentity
|
||||
// ServiceName string
|
||||
// Datacenters []string
|
||||
// Type string
|
||||
// Rules string
|
||||
// Local bool
|
||||
// AuthMethod string
|
||||
// ExpirationTime *time.Time
|
||||
// ExpirationTTL time.Duration
|
||||
// CreateTime time.Time
|
||||
// Hash []uint8
|
||||
// RaftIndex structs.RaftIndex
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// Create bool
|
||||
// Datacenter string
|
||||
// WriteRequest structs.WriteRequest
|
||||
// Token string
|
||||
// structs.ACLTokenSetRequest
|
||||
func TestDecodeACLToken(t *testing.T) {
|
||||
for _, tc := range translateValueTestCases {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
|
@ -1079,76 +1036,7 @@ func TestDecodeAgentRegisterCheck(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
// ServiceDefinition:
|
||||
// Kind structs.ServiceKind
|
||||
// ID string
|
||||
// Name string
|
||||
// Tags []string
|
||||
// Address string
|
||||
// TaggedAddresses map[string]structs.ServiceAddress
|
||||
// Address string
|
||||
// Port int
|
||||
// Meta map[string]string
|
||||
// Port int
|
||||
// Check structs.CheckType
|
||||
// CheckID types.CheckID
|
||||
// Name string
|
||||
// Status string
|
||||
// Notes string
|
||||
// ScriptArgs []string
|
||||
// HTTP string
|
||||
// Header map[string][]string
|
||||
// Method string
|
||||
// TCP string
|
||||
// Interval time.Duration
|
||||
// AliasNode string
|
||||
// AliasService string
|
||||
// DockerContainerID string
|
||||
// Shell string
|
||||
// GRPC string
|
||||
// GRPCUseTLS bool
|
||||
// TLSServerName string
|
||||
// TLSSkipVerify bool
|
||||
// Timeout time.Duration
|
||||
// TTL time.Duration
|
||||
// ProxyHTTP string
|
||||
// ProxyGRPC string
|
||||
// DeregisterCriticalServiceAfter time.Duration
|
||||
// OutputMaxSize int
|
||||
// Checks structs.CheckTypes
|
||||
// Weights *structs.Weights
|
||||
// Passing int
|
||||
// Warning int
|
||||
// Token string
|
||||
// EnableTagOverride bool
|
||||
// Proxy *structs.ConnectProxyConfig
|
||||
// DestinationServiceName string
|
||||
// DestinationServiceID string
|
||||
// LocalServiceAddress string
|
||||
// LocalServicePort int
|
||||
// Config map[string]interface {}
|
||||
// Upstreams structs.Upstreams
|
||||
// DestinationType string
|
||||
// DestinationNamespace string
|
||||
// DestinationName string
|
||||
// Datacenter string
|
||||
// LocalBindAddress string
|
||||
// LocalBindPort int
|
||||
// Config map[string]interface {}
|
||||
// MeshGateway structs.MeshGatewayConfig
|
||||
// Mode structs.MeshGatewayMode
|
||||
// MeshGateway structs.MeshGatewayConfig
|
||||
// Expose structs.ExposeConfig
|
||||
// Checks bool
|
||||
// Paths []structs.ExposePath
|
||||
// ListenerPort int
|
||||
// Path string
|
||||
// LocalPathPort int
|
||||
// Protocol string
|
||||
// ParsedFromCheck bool
|
||||
// Connect *structs.ServiceConnect
|
||||
// Native bool
|
||||
// SidecarService *structs.ServiceDefinition
|
||||
// structs.ServiceDefinition
|
||||
func TestDecodeAgentRegisterService(t *testing.T) {
|
||||
// key translation tests:
|
||||
// decodeCB fields:
|
||||
|
@ -1969,133 +1857,7 @@ func TestDecodeAgentRegisterService(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
// RegisterRequest:
|
||||
// Datacenter string
|
||||
// ID types.NodeID
|
||||
// Node string
|
||||
// Address string
|
||||
// TaggedAddresses map[string]string
|
||||
// NodeMeta map[string]string
|
||||
// Service *structs.NodeService
|
||||
// Kind structs.ServiceKind
|
||||
// ID string
|
||||
// Service string
|
||||
// Tags []string
|
||||
// Address string
|
||||
// TaggedAddresses map[string]structs.ServiceAddress
|
||||
// Address string
|
||||
// Port int
|
||||
// Meta map[string]string
|
||||
// Port int
|
||||
// Weights *structs.Weights
|
||||
// Passing int
|
||||
// Warning int
|
||||
// EnableTagOverride bool
|
||||
// Proxy structs.ConnectProxyConfig
|
||||
// DestinationServiceName string
|
||||
// DestinationServiceID string
|
||||
// LocalServiceAddress string
|
||||
// LocalServicePort int
|
||||
// Config map[string]interface {}
|
||||
// Upstreams structs.Upstreams
|
||||
// DestinationType string
|
||||
// DestinationNamespace string
|
||||
// DestinationName string
|
||||
// Datacenter string
|
||||
// LocalBindAddress string
|
||||
// LocalBindPort int
|
||||
// Config map[string]interface {}
|
||||
// MeshGateway structs.MeshGatewayConfig
|
||||
// Mode structs.MeshGatewayMode
|
||||
// MeshGateway structs.MeshGatewayConfig
|
||||
// Expose structs.ExposeConfig
|
||||
// Checks bool
|
||||
// Paths []structs.ExposePath
|
||||
// ListenerPort int
|
||||
// Path string
|
||||
// LocalPathPort int
|
||||
// Protocol string
|
||||
// ParsedFromCheck bool
|
||||
// Connect structs.ServiceConnect
|
||||
// Native bool
|
||||
// SidecarService *structs.ServiceDefinition
|
||||
// Kind structs.ServiceKind
|
||||
// ID string
|
||||
// Name string
|
||||
// Tags []string
|
||||
// Address string
|
||||
// TaggedAddresses map[string]structs.ServiceAddress
|
||||
// Meta map[string]string
|
||||
// Port int
|
||||
// Check structs.CheckType
|
||||
// CheckID types.CheckID
|
||||
// Name string
|
||||
// Status string
|
||||
// Notes string
|
||||
// ScriptArgs []string
|
||||
// HTTP string
|
||||
// Header map[string][]string
|
||||
// Method string
|
||||
// TCP string
|
||||
// Interval time.Duration
|
||||
// AliasNode string
|
||||
// AliasService string
|
||||
// DockerContainerID string
|
||||
// Shell string
|
||||
// GRPC string
|
||||
// GRPCUseTLS bool
|
||||
// TLSServerName string
|
||||
// TLSSkipVerify bool
|
||||
// Timeout time.Duration
|
||||
// TTL time.Duration
|
||||
// ProxyHTTP string
|
||||
// ProxyGRPC string
|
||||
// DeregisterCriticalServiceAfter time.Duration
|
||||
// OutputMaxSize int
|
||||
// Checks structs.CheckTypes
|
||||
// Weights *structs.Weights
|
||||
// Token string
|
||||
// EnableTagOverride bool
|
||||
// Proxy *structs.ConnectProxyConfig
|
||||
// Connect *structs.ServiceConnect
|
||||
// LocallyRegisteredAsSidecar bool
|
||||
// RaftIndex structs.RaftIndex
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// Check *structs.HealthCheck
|
||||
// Node string
|
||||
// CheckID types.CheckID
|
||||
// Name string
|
||||
// Status string
|
||||
// Notes string
|
||||
// Output string
|
||||
// ServiceID string
|
||||
// ServiceName string
|
||||
// ServiceTags []string
|
||||
// Definition structs.HealthCheckDefinition
|
||||
// HTTP string
|
||||
// TLSServerName string
|
||||
// TLSSkipVerify bool
|
||||
// Header map[string][]string
|
||||
// Method string
|
||||
// TCP string
|
||||
// Interval time.Duration
|
||||
// OutputMaxSize uint
|
||||
// Timeout time.Duration
|
||||
// DeregisterCriticalServiceAfter time.Duration
|
||||
// ScriptArgs []string
|
||||
// DockerContainerID string
|
||||
// Shell string
|
||||
// GRPC string
|
||||
// GRPCUseTLS bool
|
||||
// AliasNode string
|
||||
// AliasService string
|
||||
// TTL time.Duration
|
||||
// RaftIndex structs.RaftIndex
|
||||
// Checks structs.HealthChecks
|
||||
// SkipNodeUpdate bool
|
||||
// WriteRequest structs.WriteRequest
|
||||
// Token string
|
||||
// structs.RegisterRequest
|
||||
func TestDecodeCatalogRegister(t *testing.T) {
|
||||
for _, tc := range durationTestCases {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
|
@ -2164,28 +1926,7 @@ func TestDecodeCatalogRegister(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// IntentionRequest:
|
||||
// Datacenter string
|
||||
// Op structs.IntentionOp
|
||||
// Intention *structs.Intention
|
||||
// ID string
|
||||
// Description string
|
||||
// SourceNS string
|
||||
// SourceName string
|
||||
// DestinationNS string
|
||||
// DestinationName string
|
||||
// SourceType structs.IntentionSourceType
|
||||
// Action structs.IntentionAction
|
||||
// Meta map[string]string
|
||||
// Precedence int
|
||||
// CreatedAt time.Time mapstructure:'-'
|
||||
// UpdatedAt time.Time mapstructure:'-'
|
||||
// Hash []uint8
|
||||
// RaftIndex structs.RaftIndex
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// WriteRequest structs.WriteRequest
|
||||
// Token string
|
||||
// structs.IntentionRequest
|
||||
func TestDecodeIntentionCreate(t *testing.T) {
|
||||
for _, tc := range append(hashTestCases, timestampTestCases...) {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
|
@ -2300,22 +2041,7 @@ func TestDecodeOperatorAutopilotConfiguration(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// SessionRequest:
|
||||
// Datacenter string
|
||||
// Op structs.SessionOp
|
||||
// Session structs.Session
|
||||
// ID string
|
||||
// Name string
|
||||
// Node string
|
||||
// Checks []types.CheckID
|
||||
// LockDelay time.Duration
|
||||
// Behavior structs.SessionBehavior
|
||||
// TTL string
|
||||
// RaftIndex structs.RaftIndex
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// WriteRequest structs.WriteRequest
|
||||
// Token string
|
||||
// structs.SessionRequest
|
||||
func TestDecodeSessionCreate(t *testing.T) {
|
||||
// outSession var is shared among test cases b/c of the
|
||||
// nature/signature of the FixupChecks callback.
|
||||
|
@ -2454,137 +2180,7 @@ func TestDecodeSessionCreate(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TxnOps:
|
||||
// KV *api.KVTxnOp
|
||||
// Verb api.KVOp
|
||||
// Key string
|
||||
// Value []uint8
|
||||
// Flags uint64
|
||||
// Index uint64
|
||||
// Session string
|
||||
// Node *api.NodeTxnOp
|
||||
// Verb api.NodeOp
|
||||
// Node api.Node
|
||||
// ID string
|
||||
// Node string
|
||||
// Address string
|
||||
// Datacenter string
|
||||
// TaggedAddresses map[string]string
|
||||
// Meta map[string]string
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// Service *api.ServiceTxnOp
|
||||
// Verb api.ServiceOp
|
||||
// Node string
|
||||
// Service api.AgentService
|
||||
// Kind api.ServiceKind
|
||||
// ID string
|
||||
// Service string
|
||||
// Tags []string
|
||||
// Meta map[string]string
|
||||
// Port int
|
||||
// Address string
|
||||
// TaggedAddresses map[string]api.ServiceAddress
|
||||
// Address string
|
||||
// Port int
|
||||
// Weights api.AgentWeights
|
||||
// Passing int
|
||||
// Warning int
|
||||
// EnableTagOverride bool
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// ContentHash string
|
||||
// Proxy *api.AgentServiceConnectProxyConfig
|
||||
// DestinationServiceName string
|
||||
// DestinationServiceID string
|
||||
// LocalServiceAddress string
|
||||
// LocalServicePort int
|
||||
// Config map[string]interface {}
|
||||
// Upstreams []api.Upstream
|
||||
// DestinationType api.UpstreamDestType
|
||||
// DestinationNamespace string
|
||||
// DestinationName string
|
||||
// Datacenter string
|
||||
// LocalBindAddress string
|
||||
// LocalBindPort int
|
||||
// Config map[string]interface {}
|
||||
// MeshGateway api.MeshGatewayConfig
|
||||
// Mode api.MeshGatewayMode
|
||||
// MeshGateway api.MeshGatewayConfig
|
||||
// Expose api.ExposeConfig
|
||||
// Checks bool
|
||||
// Paths []api.ExposePath
|
||||
// ListenerPort int
|
||||
// Path string
|
||||
// LocalPathPort int
|
||||
// Protocol string
|
||||
// ParsedFromCheck bool
|
||||
// Connect *api.AgentServiceConnect
|
||||
// Native bool
|
||||
// SidecarService *api.AgentServiceRegistration
|
||||
// Kind api.ServiceKind
|
||||
// ID string
|
||||
// Name string
|
||||
// Tags []string
|
||||
// Port int
|
||||
// Address string
|
||||
// TaggedAddresses map[string]api.ServiceAddress
|
||||
// EnableTagOverride bool
|
||||
// Meta map[string]string
|
||||
// Weights *api.AgentWeights
|
||||
// Check *api.AgentServiceCheck
|
||||
// CheckID string
|
||||
// Name string
|
||||
// Args []string
|
||||
// DockerContainerID string
|
||||
// Shell string
|
||||
// Interval string
|
||||
// Timeout string
|
||||
// TTL string
|
||||
// HTTP string
|
||||
// Header map[string][]string
|
||||
// Method string
|
||||
// TCP string
|
||||
// Status string
|
||||
// Notes string
|
||||
// TLSServerName string
|
||||
// TLSSkipVerify bool
|
||||
// GRPC string
|
||||
// GRPCUseTLS bool
|
||||
// AliasNode string
|
||||
// AliasService string
|
||||
// DeregisterCriticalServiceAfter string
|
||||
// Checks api.AgentServiceChecks
|
||||
// Proxy *api.AgentServiceConnectProxyConfig
|
||||
// Connect *api.AgentServiceConnect
|
||||
// Check *api.CheckTxnOp
|
||||
// Verb api.CheckOp
|
||||
// Check api.HealthCheck
|
||||
// Node string
|
||||
// CheckID string
|
||||
// Name string
|
||||
// Status string
|
||||
// Notes string
|
||||
// Output string
|
||||
// ServiceID string
|
||||
// ServiceName string
|
||||
// ServiceTags []string
|
||||
// Definition api.HealthCheckDefinition
|
||||
// HTTP string
|
||||
// Header map[string][]string
|
||||
// Method string
|
||||
// Body string
|
||||
// TLSServerName string
|
||||
// TLSSkipVerify bool
|
||||
// TCP string
|
||||
// IntervalDuration time.Duration
|
||||
// TimeoutDuration time.Duration
|
||||
// DeregisterCriticalServiceAfterDuration time.Duration
|
||||
// Interval api.ReadableDuration
|
||||
// Timeout api.ReadableDuration
|
||||
// DeregisterCriticalServiceAfter api.ReadableDuration
|
||||
// CreateIndex uint64
|
||||
// ModifyIndex uint64
|
||||
// structs.TxnOps
|
||||
func TestDecodeTxnConvertOps(t *testing.T) {
|
||||
for _, tc := range durationTestCases {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
|
|
|
@ -50,5 +50,4 @@
|
|||
// 7. It registers the service with the proxycfg manager.
|
||||
// 7a. See: 2a.
|
||||
// 8. xDS server receives snapshots of configuration data whenever it changes.
|
||||
//
|
||||
package proxycfg
|
||||
|
|
|
@ -401,7 +401,7 @@ func upstreamIDForDC2(uid UpstreamID) UpstreamID {
|
|||
// routine. This allows the test to be fully synchronous and deterministic while still being able
|
||||
// to validate the logic of most of the watching and state updating.
|
||||
//
|
||||
// The general strategy here is to
|
||||
// The general strategy here is to:
|
||||
//
|
||||
// 1. Initialize a state with a call to newState + setting some of the extra stuff like the CacheNotifier
|
||||
// We will not be using the CacheNotifier to send notifications but calling handleUpdate ourselves
|
||||
|
|
|
@ -9,12 +9,13 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/serf/coordinate"
|
||||
"github.com/hashicorp/serf/serf"
|
||||
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/lib"
|
||||
"github.com/hashicorp/consul/sdk/testutil"
|
||||
"github.com/hashicorp/consul/types"
|
||||
"github.com/hashicorp/serf/coordinate"
|
||||
"github.com/hashicorp/serf/serf"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
@ -1297,7 +1297,6 @@ func (r *ServiceResolverRedirect) isEmpty() bool {
|
|||
// - Service, ServiceSubset, Namespace, Datacenters, and Targets cannot all be
|
||||
// empty at once. When Targets is defined, the other fields should not be
|
||||
// populated.
|
||||
//
|
||||
type ServiceResolverFailover struct {
|
||||
// Service is the service to resolve instead of the default as the failover
|
||||
// group of instances (optional).
|
||||
|
|
|
@ -147,7 +147,6 @@ func (q *QueryOptions) SetFilter(filter string) {
|
|||
q.Filter = filter
|
||||
}
|
||||
|
||||
//
|
||||
func (m *QueryMeta) GetIndex() uint64 {
|
||||
if m != nil {
|
||||
return m.Index
|
||||
|
|
|
@ -538,7 +538,6 @@ func TestAPI_ACLToken_Clone(t *testing.T) {
|
|||
require.Equal(t, cloned, read)
|
||||
}
|
||||
|
||||
//
|
||||
func TestAPI_AuthMethod_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
c, s := makeACLClient(t)
|
||||
|
|
|
@ -8,8 +8,9 @@ import (
|
|||
"reflect"
|
||||
"time"
|
||||
|
||||
consulapi "github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
|
||||
consulapi "github.com/hashicorp/consul/api"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -133,7 +134,7 @@ OUTER:
|
|||
return nil
|
||||
}
|
||||
|
||||
//Deprecated: Use RunwithClientAndHclog
|
||||
// Deprecated: Use RunwithClientAndHclog
|
||||
func (p *Plan) RunWithClientAndLogger(client *consulapi.Client, logger *log.Logger) error {
|
||||
|
||||
p.client = client
|
||||
|
|
|
@ -6,8 +6,9 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
|
||||
"github.com/hashicorp/consul/api"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -69,11 +70,10 @@ type RegisterMonitor struct {
|
|||
//
|
||||
// This is a basic state machine with the following transitions:
|
||||
//
|
||||
// * idle => running, stopped
|
||||
// * running => stopping, stopped
|
||||
// * stopping => stopped
|
||||
// * stopped => <>
|
||||
//
|
||||
// - idle => running, stopped
|
||||
// - running => stopping, stopped
|
||||
// - stopping => stopped
|
||||
// - stopped => <>
|
||||
type registerRunState uint8
|
||||
|
||||
const (
|
||||
|
|
|
@ -10,10 +10,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/agent/connect"
|
||||
"github.com/hashicorp/consul/sdk/testutil"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/hashicorp/consul/agent/connect"
|
||||
"github.com/hashicorp/consul/sdk/testutil"
|
||||
)
|
||||
|
||||
func TestValidateCommand_noTabs(t *testing.T) {
|
||||
|
|
|
@ -10,11 +10,12 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/consul/agent/connect"
|
||||
"github.com/hashicorp/consul/sdk/testutil"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/hashicorp/consul/agent/connect"
|
||||
"github.com/hashicorp/consul/sdk/testutil"
|
||||
|
||||
caCreate "github.com/hashicorp/consul/command/tls/ca/create"
|
||||
)
|
||||
|
||||
|
|
|
@ -35,9 +35,10 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/mitchellh/go-testing-interface"
|
||||
|
||||
"github.com/hashicorp/consul/agent/connect"
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/mitchellh/go-testing-interface"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -11,11 +11,12 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/consul/internal/go-sso/oidcauth/internal/strutil"
|
||||
"github.com/hashicorp/go-cleanhttp"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/mitchellh/pointerstructure"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"github.com/hashicorp/consul/internal/go-sso/oidcauth/internal/strutil"
|
||||
)
|
||||
|
||||
func contextWithHttpClient(ctx context.Context, client *http.Client) context.Context {
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
// Aliases must be lowercase, as keys are compared case-insensitive.
|
||||
//
|
||||
// Example alias tag:
|
||||
//
|
||||
// MyField []string `alias:"old_field_name,otherfieldname"`
|
||||
//
|
||||
// This hook should ONLY be used to maintain backwards compatibility with
|
||||
|
@ -143,7 +144,7 @@ type mapstructureFieldTags struct {
|
|||
// the target is a slice. This is necessary because this hook would have converted
|
||||
// the initial slices into single values on the first pass.
|
||||
//
|
||||
// Background
|
||||
// # Background
|
||||
//
|
||||
// HCL allows for repeated blocks which forces it to store structures
|
||||
// as []map[string]interface{} instead of map[string]interface{}. This is an
|
||||
|
|
|
@ -52,7 +52,6 @@ var typByteSlice = reflect.TypeOf([]byte{})
|
|||
//
|
||||
// 2.) Nested maps turn into map[interface{}]interface{}. JSON cannot
|
||||
// encode this, so we need to turn it back into map[string]interface{}.
|
||||
//
|
||||
type mapWalker struct {
|
||||
lastValue reflect.Value // lastValue of map, required for replacement
|
||||
loc, lastLoc reflectwalk.Location // locations
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
// where the clash with key names in other parts of the definition :sob:
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// m - TranslateKeys(m, map[string]string{
|
||||
// "foo_bar": "FooBar",
|
||||
// "widget.config": "",
|
||||
|
|
|
@ -15,7 +15,7 @@ var (
|
|||
now = time.Now
|
||||
)
|
||||
|
||||
//LogFile is used to setup a file based logger that also performs log rotation
|
||||
// LogFile is used to setup a file based logger that also performs log rotation
|
||||
type LogFile struct {
|
||||
//Name of the log file
|
||||
fileName string
|
||||
|
|
|
@ -296,6 +296,7 @@ type GetEnvoyBootstrapParamsRequest struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to NodeSpec:
|
||||
//
|
||||
// *GetEnvoyBootstrapParamsRequest_NodeId
|
||||
// *GetEnvoyBootstrapParamsRequest_NodeName
|
||||
NodeSpec isGetEnvoyBootstrapParamsRequest_NodeSpec `protobuf_oneof:"node_spec"`
|
||||
|
|
|
@ -281,6 +281,7 @@ type ConfigEntry struct {
|
|||
EnterpriseMeta *pbcommon.EnterpriseMeta `protobuf:"bytes,3,opt,name=EnterpriseMeta,proto3" json:"EnterpriseMeta,omitempty"`
|
||||
RaftIndex *pbcommon.RaftIndex `protobuf:"bytes,4,opt,name=RaftIndex,proto3" json:"RaftIndex,omitempty"`
|
||||
// Types that are assignable to Entry:
|
||||
//
|
||||
// *ConfigEntry_MeshConfig
|
||||
// *ConfigEntry_ServiceResolver
|
||||
// *ConfigEntry_IngressGateway
|
||||
|
|
|
@ -107,6 +107,7 @@ type SecretsWriteRequest struct {
|
|||
// PeerID is the local UUID of the peering this request applies to.
|
||||
PeerID string `protobuf:"bytes,1,opt,name=PeerID,proto3" json:"PeerID,omitempty"`
|
||||
// Types that are assignable to Request:
|
||||
//
|
||||
// *SecretsWriteRequest_GenerateToken
|
||||
// *SecretsWriteRequest_ExchangeSecret
|
||||
// *SecretsWriteRequest_PromotePending
|
||||
|
|
|
@ -78,6 +78,7 @@ type ReplicationMessage struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to Payload:
|
||||
//
|
||||
// *ReplicationMessage_Open_
|
||||
// *ReplicationMessage_Request_
|
||||
// *ReplicationMessage_Response_
|
||||
|
|
|
@ -324,6 +324,7 @@ type SubscribeRequest struct {
|
|||
// receive events (e.g. health events for a particular service).
|
||||
//
|
||||
// Types that are assignable to Subject:
|
||||
//
|
||||
// *SubscribeRequest_WildcardSubject
|
||||
// *SubscribeRequest_NamedSubject
|
||||
Subject isSubscribeRequest_Subject `protobuf_oneof:"Subject"`
|
||||
|
@ -475,6 +476,7 @@ type Event struct {
|
|||
// Payload is the actual event content.
|
||||
//
|
||||
// Types that are assignable to Payload:
|
||||
//
|
||||
// *Event_EndOfSnapshot
|
||||
// *Event_NewSnapshotToFollow
|
||||
// *Event_EventBatch
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// }
|
||||
// })
|
||||
// }
|
||||
//
|
||||
package retry
|
||||
|
||||
import (
|
||||
|
|
Loading…
Reference in New Issue