From a05982303c8919aab7501ac5a96fdf66a155af08 Mon Sep 17 00:00:00 2001 From: Carlo Teubner Date: Fri, 20 Dec 2024 13:00:45 +0000 Subject: [PATCH] golangci-lint: add gofmt Note that unlike goimports (which we already use and which includes most of the gofmt functionality), this gofmt linter is equivalent to "gofmt -s" i.e. including some code simplifications. Bring current code base into compliance with the new linter. Signed-off-by: Carlo Teubner --- .golangci.yml | 1 + pkg/server/authorizedentries/agent_test.go | 16 +- pkg/server/authorizedentries/aliases_test.go | 42 +-- pkg/server/authorizedentries/entries_test.go | 16 +- pkg/server/bundle/client/sources_test.go | 4 +- pkg/server/endpoints/auth_test.go | 2 +- .../authorized_entryfetcher_attested_nodes.go | 2 +- ...orized_entryfetcher_attested_nodes_test.go | 190 +++++----- ...rized_entryfetcher_registration_entries.go | 2 +- ..._entryfetcher_registration_entries_test.go | 330 +++++++++--------- pkg/server/endpoints/eventTracker.go | 2 +- .../nodeattestor/jointoken/join_token.go | 2 +- .../upstreamauthority/certmanager/api.go | 6 +- 13 files changed, 308 insertions(+), 307 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9306540caf..4c5447290f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,6 +14,7 @@ linters: - bodyclose - durationcheck - errorlint + - gofmt - goimports - revive - gosec diff --git a/pkg/server/authorizedentries/agent_test.go b/pkg/server/authorizedentries/agent_test.go index 884ee2f37d..c4972b3c08 100644 --- a/pkg/server/authorizedentries/agent_test.go +++ b/pkg/server/authorizedentries/agent_test.go @@ -24,8 +24,8 @@ func TestAgentRecordByID(t *testing.T) { // ExpiresAt is irrelevant. records := []agentRecord{ - agentRecord{ID: "1", ExpiresAt: 9999}, - agentRecord{ID: "2", ExpiresAt: 8888}, + {ID: "1", ExpiresAt: 9999}, + {ID: "2", ExpiresAt: 8888}, } lesser := agentRecord{} @@ -48,12 +48,12 @@ func TestAgentRecordByExpiresAt(t *testing.T) { } records := []agentRecord{ - agentRecord{ID: "1"}, - agentRecord{ID: "2"}, - agentRecord{ID: "1", ExpiresAt: 1}, - agentRecord{ID: "2", ExpiresAt: 1}, - agentRecord{ID: "1", ExpiresAt: 2}, - agentRecord{ID: "2", ExpiresAt: 2}, + {ID: "1"}, + {ID: "2"}, + {ID: "1", ExpiresAt: 1}, + {ID: "2", ExpiresAt: 1}, + {ID: "1", ExpiresAt: 2}, + {ID: "2", ExpiresAt: 2}, } lesser := agentRecord{} diff --git a/pkg/server/authorizedentries/aliases_test.go b/pkg/server/authorizedentries/aliases_test.go index 106d7302cf..e0e5f70c31 100644 --- a/pkg/server/authorizedentries/aliases_test.go +++ b/pkg/server/authorizedentries/aliases_test.go @@ -23,16 +23,16 @@ func TestAliasRecordByEntryID(t *testing.T) { } records := []aliasRecord{ - aliasRecord{EntryID: "1"}, - aliasRecord{EntryID: "1", Selector: Selector{Type: "1", Value: "1"}}, - aliasRecord{EntryID: "1", Selector: Selector{Type: "1", Value: "2"}}, - aliasRecord{EntryID: "1", Selector: Selector{Type: "2", Value: "1"}}, - aliasRecord{EntryID: "1", Selector: Selector{Type: "2", Value: "2"}}, - aliasRecord{EntryID: "2"}, - aliasRecord{EntryID: "2", Selector: Selector{Type: "1", Value: "1"}}, - aliasRecord{EntryID: "2", Selector: Selector{Type: "1", Value: "2"}}, - aliasRecord{EntryID: "2", Selector: Selector{Type: "2", Value: "1"}}, - aliasRecord{EntryID: "2", Selector: Selector{Type: "2", Value: "2"}}, + {EntryID: "1"}, + {EntryID: "1", Selector: Selector{Type: "1", Value: "1"}}, + {EntryID: "1", Selector: Selector{Type: "1", Value: "2"}}, + {EntryID: "1", Selector: Selector{Type: "2", Value: "1"}}, + {EntryID: "1", Selector: Selector{Type: "2", Value: "2"}}, + {EntryID: "2"}, + {EntryID: "2", Selector: Selector{Type: "1", Value: "1"}}, + {EntryID: "2", Selector: Selector{Type: "1", Value: "2"}}, + {EntryID: "2", Selector: Selector{Type: "2", Value: "1"}}, + {EntryID: "2", Selector: Selector{Type: "2", Value: "2"}}, } lesser := aliasRecord{} @@ -50,17 +50,17 @@ func TestAliasRecordBySelector(t *testing.T) { } records := []aliasRecord{ - aliasRecord{Selector: Selector{Type: "1", Value: "1"}}, - aliasRecord{Selector: Selector{Type: "1", Value: "1"}, EntryID: "1"}, - aliasRecord{Selector: Selector{Type: "1", Value: "1"}, EntryID: "2"}, - aliasRecord{Selector: Selector{Type: "1", Value: "2"}, EntryID: "1"}, - aliasRecord{Selector: Selector{Type: "1", Value: "2"}, EntryID: "2"}, - aliasRecord{Selector: Selector{Type: "2", Value: "1"}}, - aliasRecord{Selector: Selector{Type: "2", Value: "1"}, EntryID: "1"}, - aliasRecord{Selector: Selector{Type: "2", Value: "1"}, EntryID: "2"}, - aliasRecord{Selector: Selector{Type: "2", Value: "2"}}, - aliasRecord{Selector: Selector{Type: "2", Value: "2"}, EntryID: "1"}, - aliasRecord{Selector: Selector{Type: "2", Value: "2"}, EntryID: "2"}, + {Selector: Selector{Type: "1", Value: "1"}}, + {Selector: Selector{Type: "1", Value: "1"}, EntryID: "1"}, + {Selector: Selector{Type: "1", Value: "1"}, EntryID: "2"}, + {Selector: Selector{Type: "1", Value: "2"}, EntryID: "1"}, + {Selector: Selector{Type: "1", Value: "2"}, EntryID: "2"}, + {Selector: Selector{Type: "2", Value: "1"}}, + {Selector: Selector{Type: "2", Value: "1"}, EntryID: "1"}, + {Selector: Selector{Type: "2", Value: "1"}, EntryID: "2"}, + {Selector: Selector{Type: "2", Value: "2"}}, + {Selector: Selector{Type: "2", Value: "2"}, EntryID: "1"}, + {Selector: Selector{Type: "2", Value: "2"}, EntryID: "2"}, } lesser := aliasRecord{} for _, greater := range records { diff --git a/pkg/server/authorizedentries/entries_test.go b/pkg/server/authorizedentries/entries_test.go index 653b3f3c16..2463cf3597 100644 --- a/pkg/server/authorizedentries/entries_test.go +++ b/pkg/server/authorizedentries/entries_test.go @@ -24,8 +24,8 @@ func TestEntryRecordByEntryID(t *testing.T) { // ParentID is irrelevant. records := []entryRecord{ - entryRecord{EntryID: "1", ParentID: "2"}, - entryRecord{EntryID: "2", ParentID: "1"}, + {EntryID: "1", ParentID: "2"}, + {EntryID: "2", ParentID: "1"}, } lesser := entryRecord{} @@ -43,12 +43,12 @@ func TestEntryRecordByParentID(t *testing.T) { } records := []entryRecord{ - entryRecord{ParentID: "1"}, - entryRecord{ParentID: "1", EntryID: "1"}, - entryRecord{ParentID: "1", EntryID: "2"}, - entryRecord{ParentID: "2"}, - entryRecord{ParentID: "2", EntryID: "1"}, - entryRecord{ParentID: "2", EntryID: "2"}, + {ParentID: "1"}, + {ParentID: "1", EntryID: "1"}, + {ParentID: "1", EntryID: "2"}, + {ParentID: "2"}, + {ParentID: "2", EntryID: "1"}, + {ParentID: "2", EntryID: "2"}, } lesser := entryRecord{} diff --git a/pkg/server/bundle/client/sources_test.go b/pkg/server/bundle/client/sources_test.go index ffa498eb45..aeff4cbe99 100644 --- a/pkg/server/bundle/client/sources_test.go +++ b/pkg/server/bundle/client/sources_test.go @@ -61,8 +61,8 @@ func TestMergedTrustDomainConfigSource(t *testing.T) { require.NoError(t, err) require.Equal(t, map[spiffeid.TrustDomain]client.TrustDomainConfig{ - domain1: client.TrustDomainConfig{EndpointURL: "A"}, - domain2: client.TrustDomainConfig{EndpointURL: "A"}, + domain1: {EndpointURL: "A"}, + domain2: {EndpointURL: "A"}, }, configs) }) } diff --git a/pkg/server/endpoints/auth_test.go b/pkg/server/endpoints/auth_test.go index b2ff8e5117..cbc63e3efb 100644 --- a/pkg/server/endpoints/auth_test.go +++ b/pkg/server/endpoints/auth_test.go @@ -105,7 +105,7 @@ func TestBundleSource(t *testing.T) { { name: "success, with authorities", getter: func(domain spiffeid.TrustDomain) ([]*x509.Certificate, error) { - return []*x509.Certificate{&x509.Certificate{}}, nil + return []*x509.Certificate{{}}, nil }, trustDomain: spiffeid.RequireTrustDomainFromString("example.org"), want: x509bundle.FromX509Authorities( diff --git a/pkg/server/endpoints/authorized_entryfetcher_attested_nodes.go b/pkg/server/endpoints/authorized_entryfetcher_attested_nodes.go index 32b854f213..a514f67d89 100644 --- a/pkg/server/endpoints/authorized_entryfetcher_attested_nodes.go +++ b/pkg/server/endpoints/authorized_entryfetcher_attested_nodes.go @@ -212,7 +212,7 @@ func (a *attestedNodes) updateCache(ctx context.Context) error { } func (a *attestedNodes) updateCachedNodes(ctx context.Context) error { - for spiffeId, _ := range a.fetchNodes { + for spiffeId := range a.fetchNodes { node, err := a.ds.FetchAttestedNode(ctx, spiffeId) if err != nil { return err diff --git a/pkg/server/endpoints/authorized_entryfetcher_attested_nodes_test.go b/pkg/server/endpoints/authorized_entryfetcher_attested_nodes_test.go index 7e4b8b187d..571aee5c0f 100644 --- a/pkg/server/endpoints/authorized_entryfetcher_attested_nodes_test.go +++ b/pkg/server/endpoints/authorized_entryfetcher_attested_nodes_test.go @@ -41,11 +41,11 @@ var ( }, } defaultNodeEventsStartingAt60 = []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 60, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 61, SpiffeID: "spiffe://example.org/test_node_3", }, @@ -94,9 +94,9 @@ func TestLoadNodeCache(t *testing.T) { "spiffe://example.org/test_node_1", }, expectedGauges: []expectedGauge{ - expectedGauge{Key: skippedNodeEventID, Value: 0}, - expectedGauge{Key: cachedAgentsByID, Value: 1}, - expectedGauge{Key: cachedAgentsByExpiresAt, Value: 1}, + {Key: skippedNodeEventID, Value: 0}, + {Key: cachedAgentsByID, Value: 1}, + {Key: cachedAgentsByExpiresAt, Value: 1}, }, }, { @@ -265,7 +265,7 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { waitToPoll: time.Duration(2) * defaultSQLTransactionTimeout, // even with new before first events, they shouldn't load polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 58, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -294,7 +294,7 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { attestedNodeEvents: defaultNodeEventsStartingAt60, }, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 58, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -311,7 +311,7 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { attestedNodeEvents: defaultNodeEventsStartingAt60, }, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 64, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -329,7 +329,7 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { }, eventsBeforeFirst: []uint{58}, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 58, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -347,11 +347,11 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { }, eventsBeforeFirst: []uint{58}, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: defaultFirstNodeEvent - 2, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: defaultLastNodeEvent + 2, SpiffeID: "spiffe://example.org/test_node_4", }, @@ -368,23 +368,23 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { attestedNodeEvents: defaultNodeEventsStartingAt60, }, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 48, SpiffeID: "spiffe://example.org/test_node_10", }, - &datastore.AttestedNodeEvent{ + { EventID: 49, SpiffeID: "spiffe://example.org/test_node_11", }, - &datastore.AttestedNodeEvent{ + { EventID: 53, SpiffeID: "spiffe://example.org/test_node_12", }, - &datastore.AttestedNodeEvent{ + { EventID: 56, SpiffeID: "spiffe://example.org/test_node_13", }, - &datastore.AttestedNodeEvent{ + { EventID: 57, SpiffeID: "spiffe://example.org/test_node_14", }, @@ -407,23 +407,23 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { attestedNodeEvents: defaultNodeEventsStartingAt60, }, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 48, SpiffeID: "spiffe://example.org/test_node_10", }, - &datastore.AttestedNodeEvent{ + { EventID: 49, SpiffeID: "spiffe://example.org/test_node_11", }, - &datastore.AttestedNodeEvent{ + { EventID: 53, SpiffeID: "spiffe://example.org/test_node_12", }, - &datastore.AttestedNodeEvent{ + { EventID: 56, SpiffeID: "spiffe://example.org/test_node_13", }, - &datastore.AttestedNodeEvent{ + { EventID: defaultLastNodeEvent + 1, SpiffeID: "spiffe://example.org/test_node_14", }, @@ -446,23 +446,23 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { eventsBeforeFirst: []uint{48, 49}, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 48, SpiffeID: "spiffe://example.org/test_node_10", }, - &datastore.AttestedNodeEvent{ + { EventID: 49, SpiffeID: "spiffe://example.org/test_node_11", }, - &datastore.AttestedNodeEvent{ + { EventID: 53, SpiffeID: "spiffe://example.org/test_node_12", }, - &datastore.AttestedNodeEvent{ + { EventID: 56, SpiffeID: "spiffe://example.org/test_node_13", }, - &datastore.AttestedNodeEvent{ + { EventID: 57, SpiffeID: "spiffe://example.org/test_node_14", }, @@ -483,23 +483,23 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { }, eventsBeforeFirst: []uint{48, 49}, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 48, SpiffeID: "spiffe://example.org/test_node_10", }, - &datastore.AttestedNodeEvent{ + { EventID: 49, SpiffeID: "spiffe://example.org/test_node_11", }, - &datastore.AttestedNodeEvent{ + { EventID: 53, SpiffeID: "spiffe://example.org/test_node_12", }, - &datastore.AttestedNodeEvent{ + { EventID: 56, SpiffeID: "spiffe://example.org/test_node_13", }, - &datastore.AttestedNodeEvent{ + { EventID: defaultLastNodeEvent + 1, SpiffeID: "spiffe://example.org/test_node_14", }, @@ -520,23 +520,23 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { eventsBeforeFirst: []uint{48, 49, 53, 56, 57}, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 48, SpiffeID: "spiffe://example.org/test_node_10", }, - &datastore.AttestedNodeEvent{ + { EventID: 49, SpiffeID: "spiffe://example.org/test_node_11", }, - &datastore.AttestedNodeEvent{ + { EventID: 53, SpiffeID: "spiffe://example.org/test_node_12", }, - &datastore.AttestedNodeEvent{ + { EventID: 56, SpiffeID: "spiffe://example.org/test_node_13", }, - &datastore.AttestedNodeEvent{ + { EventID: 57, SpiffeID: "spiffe://example.org/test_node_14", }, @@ -554,27 +554,27 @@ func TestSearchBeforeFirstNodeEvent(t *testing.T) { eventsBeforeFirst: []uint{48, 49, 53, 56, 57}, polledEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 48, SpiffeID: "spiffe://example.org/test_node_10", }, - &datastore.AttestedNodeEvent{ + { EventID: 49, SpiffeID: "spiffe://example.org/test_node_11", }, - &datastore.AttestedNodeEvent{ + { EventID: 53, SpiffeID: "spiffe://example.org/test_node_12", }, - &datastore.AttestedNodeEvent{ + { EventID: 56, SpiffeID: "spiffe://example.org/test_node_13", }, - &datastore.AttestedNodeEvent{ + { EventID: 57, SpiffeID: "spiffe://example.org/test_node_14", }, - &datastore.AttestedNodeEvent{ + { EventID: defaultLastNodeEvent + 1, SpiffeID: "spiffe://example.org/test_node_28", }, @@ -640,7 +640,7 @@ func TestSelectedPolledNodeEvents(t *testing.T) { name: "nothing to poll, no action take, one event", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 100, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -651,23 +651,23 @@ func TestSelectedPolledNodeEvents(t *testing.T) { name: "nothing to poll, no action taken, five events", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_3", }, - &datastore.AttestedNodeEvent{ + { EventID: 104, SpiffeID: "spiffe://example.org/test_node_4", }, - &datastore.AttestedNodeEvent{ + { EventID: 105, SpiffeID: "spiffe://example.org/test_node_5", }, @@ -678,19 +678,19 @@ func TestSelectedPolledNodeEvents(t *testing.T) { name: "polling one item, not found", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 104, SpiffeID: "spiffe://example.org/test_node_4", }, - &datastore.AttestedNodeEvent{ + { EventID: 105, SpiffeID: "spiffe://example.org/test_node_5", }, @@ -702,11 +702,11 @@ func TestSelectedPolledNodeEvents(t *testing.T) { name: "polling five items, not found", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 107, SpiffeID: "spiffe://example.org/test_node_7", }, @@ -718,15 +718,15 @@ func TestSelectedPolledNodeEvents(t *testing.T) { name: "polling one item, found", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_3", }, @@ -742,19 +742,19 @@ func TestSelectedPolledNodeEvents(t *testing.T) { name: "polling five items, two found", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_3", }, - &datastore.AttestedNodeEvent{ + { EventID: 106, SpiffeID: "spiffe://example.org/test_node_6", }, - &datastore.AttestedNodeEvent{ + { EventID: 107, SpiffeID: "spiffe://example.org/test_node_7", }, @@ -771,31 +771,31 @@ func TestSelectedPolledNodeEvents(t *testing.T) { name: "polling five items, five found", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_3", }, - &datastore.AttestedNodeEvent{ + { EventID: 104, SpiffeID: "spiffe://example.org/test_node_4", }, - &datastore.AttestedNodeEvent{ + { EventID: 105, SpiffeID: "spiffe://example.org/test_node_5", }, - &datastore.AttestedNodeEvent{ + { EventID: 106, SpiffeID: "spiffe://example.org/test_node_6", }, - &datastore.AttestedNodeEvent{ + { EventID: 107, SpiffeID: "spiffe://example.org/test_node_7", }, @@ -851,7 +851,7 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "no new event, with first event", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -865,14 +865,14 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "one new event", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, }, }, newEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -887,14 +887,14 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "one new event, skipping an event", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, }, }, newEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -909,18 +909,18 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "two new events, same attested node", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, }, }, newEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_1", }, @@ -935,18 +935,18 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "two new events, different attested nodes", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, }, }, newEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_2", }, @@ -962,18 +962,18 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "two new events, with a skipped event", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, }, }, newEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 104, SpiffeID: "spiffe://example.org/test_node_2", }, @@ -989,18 +989,18 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "two new events, with three skipped events", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, }, }, newEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 106, SpiffeID: "spiffe://example.org/test_node_2", }, @@ -1016,42 +1016,42 @@ func TestScanForNewNodeEvents(t *testing.T) { name: "five events, four new events, two skip regions", setup: &nodeScenarioSetup{ attestedNodeEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 101, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 102, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 103, SpiffeID: "spiffe://example.org/test_node_3", }, - &datastore.AttestedNodeEvent{ + { EventID: 104, SpiffeID: "spiffe://example.org/test_node_4", }, - &datastore.AttestedNodeEvent{ + { EventID: 105, SpiffeID: "spiffe://example.org/test_node_5", }, }, }, newEvents: []*datastore.AttestedNodeEvent{ - &datastore.AttestedNodeEvent{ + { EventID: 108, SpiffeID: "spiffe://example.org/test_node_1", }, - &datastore.AttestedNodeEvent{ + { EventID: 109, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 110, SpiffeID: "spiffe://example.org/test_node_2", }, - &datastore.AttestedNodeEvent{ + { EventID: 112, SpiffeID: "spiffe://example.org/test_node_11", }, @@ -1539,7 +1539,7 @@ func (s *scenario) buildAttestedNodesCache() (*attestedNodes, error) { attestedNodes, err := buildAttestedNodesCache(s.ctx, s.log, s.metrics, s.ds, s.clk, s.cache, defaultCacheReloadInterval, defaultSQLTransactionTimeout) if attestedNodes != nil { // clear out the fetches - for node, _ := range attestedNodes.fetchNodes { + for node := range attestedNodes.fetchNodes { delete(attestedNodes.fetchNodes, node) } } diff --git a/pkg/server/endpoints/authorized_entryfetcher_registration_entries.go b/pkg/server/endpoints/authorized_entryfetcher_registration_entries.go index 3fd9914c6d..cc32536cef 100644 --- a/pkg/server/endpoints/authorized_entryfetcher_registration_entries.go +++ b/pkg/server/endpoints/authorized_entryfetcher_registration_entries.go @@ -224,7 +224,7 @@ func (a *registrationEntries) updateCache(ctx context.Context) error { // updateCacheEntry update/deletes/creates an individual registration entry in the cache. func (a *registrationEntries) updateCachedEntries(ctx context.Context) error { - for entryId, _ := range a.fetchEntries { + for entryId := range a.fetchEntries { commonEntry, err := a.ds.FetchRegistrationEntry(ctx, entryId) if err != nil { return err diff --git a/pkg/server/endpoints/authorized_entryfetcher_registration_entries_test.go b/pkg/server/endpoints/authorized_entryfetcher_registration_entries_test.go index d9e4d6d4e1..1b31319f37 100644 --- a/pkg/server/endpoints/authorized_entryfetcher_registration_entries_test.go +++ b/pkg/server/endpoints/authorized_entryfetcher_registration_entries_test.go @@ -29,7 +29,7 @@ var ( skippedEntryEventID = []string{telemetry.Entry, telemetry.SkippedEntryEventIDs, telemetry.Count} defaultRegistrationEntries = []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -37,7 +37,7 @@ var ( {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -47,11 +47,11 @@ var ( }, } defaultRegistrationEntryEventsStartingAt60 = []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 60, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 61, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, @@ -96,7 +96,7 @@ func TestLoadEntryCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 0, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -113,7 +113,7 @@ func TestLoadEntryCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1000, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -127,11 +127,11 @@ func TestLoadEntryCache(t *testing.T) { "6837984a-bc44-462b-9ca6-5cd59be35066", }, expectedGauges: []expectedGauge{ - expectedGauge{Key: skippedEntryEventID, Value: 0}, - expectedGauge{Key: nodeAliasesByEntryID, Value: 0}, - expectedGauge{Key: nodeAliasesBySelector, Value: 0}, - expectedGauge{Key: entriesByEntryID, Value: 1}, - expectedGauge{Key: entriesByParentID, Value: 1}, + {Key: skippedEntryEventID, Value: 0}, + {Key: nodeAliasesByEntryID, Value: 0}, + {Key: nodeAliasesBySelector, Value: 0}, + {Key: entriesByEntryID, Value: 1}, + {Key: entriesByParentID, Value: 1}, }, }, { @@ -139,7 +139,7 @@ func TestLoadEntryCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 0, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -147,7 +147,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -155,7 +155,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -163,7 +163,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "3"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -171,7 +171,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "4"}, }, }, - &common.RegistrationEntry{ + { EntryId: "354c16f4-4e61-4c17-8596-7baa7744d504", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_5", @@ -188,7 +188,7 @@ func TestLoadEntryCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1000, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -196,7 +196,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -204,7 +204,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -212,7 +212,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "3"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -220,7 +220,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "4"}, }, }, - &common.RegistrationEntry{ + { EntryId: "354c16f4-4e61-4c17-8596-7baa7744d504", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_5", @@ -238,11 +238,11 @@ func TestLoadEntryCache(t *testing.T) { "354c16f4-4e61-4c17-8596-7baa7744d504", }, expectedGauges: []expectedGauge{ - expectedGauge{Key: skippedEntryEventID, Value: 0}, - expectedGauge{Key: nodeAliasesByEntryID, Value: 0}, - expectedGauge{Key: nodeAliasesBySelector, Value: 0}, - expectedGauge{Key: entriesByEntryID, Value: 5}, - expectedGauge{Key: entriesByParentID, Value: 5}, + {Key: skippedEntryEventID, Value: 0}, + {Key: nodeAliasesByEntryID, Value: 0}, + {Key: nodeAliasesBySelector, Value: 0}, + {Key: entriesByEntryID, Value: 5}, + {Key: entriesByParentID, Value: 5}, }, }, { @@ -250,7 +250,7 @@ func TestLoadEntryCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 5, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -258,7 +258,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -266,7 +266,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -274,7 +274,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "3"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -282,7 +282,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "4"}, }, }, - &common.RegistrationEntry{ + { EntryId: "354c16f4-4e61-4c17-8596-7baa7744d504", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_5", @@ -300,11 +300,11 @@ func TestLoadEntryCache(t *testing.T) { "354c16f4-4e61-4c17-8596-7baa7744d504", }, expectedGauges: []expectedGauge{ - expectedGauge{Key: skippedEntryEventID, Value: 0}, - expectedGauge{Key: nodeAliasesByEntryID, Value: 0}, - expectedGauge{Key: nodeAliasesBySelector, Value: 0}, - expectedGauge{Key: entriesByEntryID, Value: 5}, - expectedGauge{Key: entriesByParentID, Value: 5}, + {Key: skippedEntryEventID, Value: 0}, + {Key: nodeAliasesByEntryID, Value: 0}, + {Key: nodeAliasesBySelector, Value: 0}, + {Key: entriesByEntryID, Value: 5}, + {Key: entriesByParentID, Value: 5}, }, }, { @@ -312,7 +312,7 @@ func TestLoadEntryCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 3, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -320,7 +320,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -328,7 +328,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -336,7 +336,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "3"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -344,7 +344,7 @@ func TestLoadEntryCache(t *testing.T) { {Type: "testjob", Value: "4"}, }, }, - &common.RegistrationEntry{ + { EntryId: "354c16f4-4e61-4c17-8596-7baa7744d504", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_5", @@ -362,11 +362,11 @@ func TestLoadEntryCache(t *testing.T) { "354c16f4-4e61-4c17-8596-7baa7744d504", }, expectedGauges: []expectedGauge{ - expectedGauge{Key: skippedEntryEventID, Value: 0}, - expectedGauge{Key: nodeAliasesByEntryID, Value: 0}, - expectedGauge{Key: nodeAliasesBySelector, Value: 0}, - expectedGauge{Key: entriesByEntryID, Value: 5}, - expectedGauge{Key: entriesByParentID, Value: 5}, + {Key: skippedEntryEventID, Value: 0}, + {Key: nodeAliasesByEntryID, Value: 0}, + {Key: nodeAliasesBySelector, Value: 0}, + {Key: entriesByEntryID, Value: 5}, + {Key: entriesByParentID, Value: 5}, }, }, } { @@ -450,7 +450,7 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { waitToPoll: time.Duration(2) * defaultSQLTransactionTimeout, // even with new before first events, they shouldn't load polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 58, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -481,7 +481,7 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { registrationEntryEvents: defaultRegistrationEntryEventsStartingAt60, }, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 58, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -501,7 +501,7 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { registrationEntryEvents: defaultRegistrationEntryEventsStartingAt60, }, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 64, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -520,7 +520,7 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { }, eventsBeforeFirst: []uint{58}, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 58, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -539,11 +539,11 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { }, eventsBeforeFirst: []uint{58}, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: defaultFirstEntryEvent - 2, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: defaultLastEntryEvent + 2, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, @@ -561,23 +561,23 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { registrationEntryEvents: defaultRegistrationEntryEventsStartingAt60, }, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 48, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 49, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 53, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 56, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 57, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, @@ -601,23 +601,23 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { registrationEntryEvents: defaultRegistrationEntryEventsStartingAt60, }, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 48, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 49, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 53, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 56, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: defaultLastEntryEvent + 1, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, @@ -641,23 +641,23 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { eventsBeforeFirst: []uint{48, 49}, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 48, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 49, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 53, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 56, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 57, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, @@ -679,23 +679,23 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { }, eventsBeforeFirst: []uint{48, 49}, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 48, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 49, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 53, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 56, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: defaultLastEntryEvent + 1, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, @@ -717,23 +717,23 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { eventsBeforeFirst: []uint{48, 49, 53, 56, 57}, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 48, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 49, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 53, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 56, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 57, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, @@ -752,27 +752,27 @@ func TestSearchBeforeFirstEntryEvent(t *testing.T) { eventsBeforeFirst: []uint{48, 49, 53, 56, 57}, polledEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 48, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 49, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 53, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 56, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 57, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, - &datastore.RegistrationEntryEvent{ + { EventID: defaultLastEntryEvent + 1, EntryID: "aeb603b2-e1d1-4832-8809-60a1d14b42e0", }, @@ -837,7 +837,7 @@ func TestSelectedPolledEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 100, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -849,23 +849,23 @@ func TestSelectedPolledEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 104, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 105, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, @@ -877,19 +877,19 @@ func TestSelectedPolledEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 104, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 105, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, @@ -902,11 +902,11 @@ func TestSelectedPolledEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 107, EntryID: "c3f4ada0-3f8d-421e-b5d1-83aaee203d94", }, @@ -919,15 +919,15 @@ func TestSelectedPolledEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, @@ -944,19 +944,19 @@ func TestSelectedPolledEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 106, EntryID: "aeb603b2-e1d1-4832-8809-60a1d14b42e0", }, - &datastore.RegistrationEntryEvent{ + { EventID: 107, EntryID: "c3f4ada0-3f8d-421e-b5d1-83aaee203d94", }, @@ -974,31 +974,31 @@ func TestSelectedPolledEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 104, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 105, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, - &datastore.RegistrationEntryEvent{ + { EventID: 106, EntryID: "aeb603b2-e1d1-4832-8809-60a1d14b42e0", }, - &datastore.RegistrationEntryEvent{ + { EventID: 107, EntryID: "c3f4ada0-3f8d-421e-b5d1-83aaee203d94", }, @@ -1058,7 +1058,7 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -1073,14 +1073,14 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, }, }, newEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -1096,14 +1096,14 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, }, }, newEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -1119,18 +1119,18 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, }, }, newEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, @@ -1146,18 +1146,18 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, }, }, newEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, @@ -1174,18 +1174,18 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, }, }, newEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 104, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, @@ -1202,18 +1202,18 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, }, }, newEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 106, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, @@ -1230,42 +1230,42 @@ func TestScanForNewEntryEvents(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntryEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 101, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 102, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 103, EntryID: "1d78521b-cc92-47c1-85a5-28ce47f121f2", }, - &datastore.RegistrationEntryEvent{ + { EventID: 104, EntryID: "8cbf7d48-9d43-41ae-ab63-77d66891f948", }, - &datastore.RegistrationEntryEvent{ + { EventID: 105, EntryID: "354c16f4-4e61-4c17-8596-7baa7744d504", }, }, }, newEvents: []*datastore.RegistrationEntryEvent{ - &datastore.RegistrationEntryEvent{ + { EventID: 108, EntryID: "6837984a-bc44-462b-9ca6-5cd59be35066", }, - &datastore.RegistrationEntryEvent{ + { EventID: 109, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 110, EntryID: "47c96201-a4b1-4116-97fe-8aa9c2440aad", }, - &datastore.RegistrationEntryEvent{ + { EventID: 112, EntryID: "c3f4ada0-3f8d-421e-b5d1-83aaee203d94", }, @@ -1324,7 +1324,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { pageSize: 1024, }, createRegistrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1356,7 +1356,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { pageSize: 1024, }, createRegistrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -1364,7 +1364,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -1372,7 +1372,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1380,7 +1380,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "3"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -1388,7 +1388,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "4"}, }, }, - &common.RegistrationEntry{ + { EntryId: "354c16f4-4e61-4c17-8596-7baa7744d504", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_5", @@ -1419,7 +1419,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { pageSize: 1024, }, createRegistrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -1427,7 +1427,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1435,7 +1435,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "3"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -1478,7 +1478,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1498,7 +1498,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1509,7 +1509,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { }, }, createRegistrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -1532,7 +1532,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1555,7 +1555,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1579,7 +1579,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1590,7 +1590,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { }, }, createRegistrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -1598,7 +1598,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -1606,7 +1606,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -1614,7 +1614,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "4"}, }, }, - &common.RegistrationEntry{ + { EntryId: "354c16f4-4e61-4c17-8596-7baa7744d504", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_5", @@ -1622,7 +1622,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "5"}, }, }, - &common.RegistrationEntry{ + { EntryId: "aeb603b2-e1d1-4832-8809-60a1d14b42e0", ParentId: "spiffe://example.org/test_node_3", SpiffeId: "spiffe://example.org/test_job_6", @@ -1653,7 +1653,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1664,7 +1664,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { }, }, createRegistrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -1672,7 +1672,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -1680,7 +1680,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "2"}, }, }, - &common.RegistrationEntry{ + { EntryId: "8cbf7d48-9d43-41ae-ab63-77d66891f948", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_4", @@ -1688,7 +1688,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "4"}, }, }, - &common.RegistrationEntry{ + { EntryId: "354c16f4-4e61-4c17-8596-7baa7744d504", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_5", @@ -1718,7 +1718,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1729,7 +1729,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { }, }, createRegistrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "6837984a-bc44-462b-9ca6-5cd59be35066", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_1", @@ -1737,7 +1737,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { {Type: "testjob", Value: "1"}, }, }, - &common.RegistrationEntry{ + { EntryId: "47c96201-a4b1-4116-97fe-8aa9c2440aad", ParentId: "spiffe://example.org/test_node_1", SpiffeId: "spiffe://example.org/test_job_2", @@ -1767,7 +1767,7 @@ func TestUpdateRegistrationEntriesCache(t *testing.T) { setup: &entryScenarioSetup{ pageSize: 1024, registrationEntries: []*common.RegistrationEntry{ - &common.RegistrationEntry{ + { EntryId: "1d78521b-cc92-47c1-85a5-28ce47f121f2", ParentId: "spiffe://example.org/test_node_2", SpiffeId: "spiffe://example.org/test_job_3", @@ -1911,7 +1911,7 @@ func (s *entryScenario) buildRegistrationEntriesCache() (*registrationEntries, e registrationEntries, err := buildRegistrationEntriesCache(s.ctx, s.log, s.metrics, s.ds, s.clk, s.cache, s.pageSize, defaultCacheReloadInterval, defaultSQLTransactionTimeout) if registrationEntries != nil { // clear out the fetches - for entry, _ := range registrationEntries.fetchEntries { + for entry := range registrationEntries.fetchEntries { delete(registrationEntries.fetchEntries, entry) } } diff --git a/pkg/server/endpoints/eventTracker.go b/pkg/server/endpoints/eventTracker.go index 7be1913bb1..dcaf493b8c 100644 --- a/pkg/server/endpoints/eventTracker.go +++ b/pkg/server/endpoints/eventTracker.go @@ -58,7 +58,7 @@ func (et *eventTracker) StopTracking(event uint) { func (et *eventTracker) SelectEvents() []uint { pollList := *et.pool.Get().(*[]uint) - for event, _ := range et.events { + for event := range et.events { if et.events[event] >= et.pollPeriods { et.StopTracking(event) continue diff --git a/pkg/server/plugin/nodeattestor/jointoken/join_token.go b/pkg/server/plugin/nodeattestor/jointoken/join_token.go index 4237e58172..4192cbeb74 100644 --- a/pkg/server/plugin/nodeattestor/jointoken/join_token.go +++ b/pkg/server/plugin/nodeattestor/jointoken/join_token.go @@ -39,7 +39,7 @@ func buildConfig(coreConfig catalog.CoreConfig, hclText string, status *pluginco return nil } - for key, _ := range newConfig.Extra { + for key := range newConfig.Extra { status.ReportInfof("unknown setting \"%s\" encountered", key) } diff --git a/pkg/server/plugin/upstreamauthority/certmanager/api.go b/pkg/server/plugin/upstreamauthority/certmanager/api.go index fdaf6d6c5f..203ecd3056 100644 --- a/pkg/server/plugin/upstreamauthority/certmanager/api.go +++ b/pkg/server/plugin/upstreamauthority/certmanager/api.go @@ -83,15 +83,15 @@ func (p *Plugin) cleanupStaleCertificateRequests(ctx context.Context) error { for i, cr := range crList.Items { for _, cond := range []cmapi.CertificateRequestCondition{ - cmapi.CertificateRequestCondition{ + { Type: cmapi.CertificateRequestConditionDenied, Status: cmapi.ConditionTrue, }, - cmapi.CertificateRequestCondition{ + { Type: cmapi.CertificateRequestConditionReady, Status: cmapi.ConditionTrue, }, - cmapi.CertificateRequestCondition{ + { Type: cmapi.CertificateRequestConditionReady, Status: cmapi.ConditionFalse, Reason: cmapi.CertificateRequestReasonFailed,