diff --git a/central/activecomponent/datastore/internal/store/postgres/store_test.go b/central/activecomponent/datastore/internal/store/postgres/store_test.go index efa6f157df936..04df2719003f8 100644 --- a/central/activecomponent/datastore/internal/store/postgres/store_test.go +++ b/central/activecomponent/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ActiveComponentsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, activeComponents)) + foundActiveComponents, missing, err := store.GetMany(ctx, activeComponentIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), activeComponents, foundActiveComponents) + activeComponentCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, activeComponentCount) diff --git a/central/administration/events/datastore/internal/store/postgres/store_test.go b/central/administration/events/datastore/internal/store/postgres/store_test.go index 4f1e34af01e13..cf9e5104ea203 100644 --- a/central/administration/events/datastore/internal/store/postgres/store_test.go +++ b/central/administration/events/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *AdministrationEventsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, administrationEvents)) + foundAdministrationEvents, missing, err := store.GetMany(ctx, administrationEventIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), administrationEvents, foundAdministrationEvents) + administrationEventCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, administrationEventCount) diff --git a/central/administration/usage/store/postgres/store_test.go b/central/administration/usage/store/postgres/store_test.go index d7added1f50cb..720dfbdeee1d0 100644 --- a/central/administration/usage/store/postgres/store_test.go +++ b/central/administration/usage/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *SecuredUnitsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, securedUnitss)) + foundSecuredUnitss, missing, err := store.GetMany(ctx, securedUnitsIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), securedUnitss, foundSecuredUnitss) + securedUnitsCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, securedUnitsCount) diff --git a/central/alert/datastore/internal/store/postgres/store_test.go b/central/alert/datastore/internal/store/postgres/store_test.go index 5166f8ee2cfff..e72d6cd47f34f 100644 --- a/central/alert/datastore/internal/store/postgres/store_test.go +++ b/central/alert/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *AlertsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, alerts)) + foundAlerts, missing, err := store.GetMany(ctx, alertIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), alerts, foundAlerts) + alertCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, alertCount) diff --git a/central/apitoken/datastore/internal/store/postgres/store_test.go b/central/apitoken/datastore/internal/store/postgres/store_test.go index 129ea14ad91a2..533a2655a972c 100644 --- a/central/apitoken/datastore/internal/store/postgres/store_test.go +++ b/central/apitoken/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *APITokensStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, tokenMetadatas)) + foundTokenMetadatas, missing, err := store.GetMany(ctx, tokenMetadataIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), tokenMetadatas, foundTokenMetadatas) + tokenMetadataCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, tokenMetadataCount) diff --git a/central/auth/store/postgres/store_test.go b/central/auth/store/postgres/store_test.go index 25c1e66430395..caeac9ec4759b 100644 --- a/central/auth/store/postgres/store_test.go +++ b/central/auth/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *AuthMachineToMachineConfigsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, authMachineToMachineConfigs)) + foundAuthMachineToMachineConfigs, missing, err := store.GetMany(ctx, authMachineToMachineConfigIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), authMachineToMachineConfigs, foundAuthMachineToMachineConfigs) + authMachineToMachineConfigCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, authMachineToMachineConfigCount) diff --git a/central/authprovider/datastore/internal/store/postgres/store_test.go b/central/authprovider/datastore/internal/store/postgres/store_test.go index 3a55fa4dc7e5b..7616f7057803f 100644 --- a/central/authprovider/datastore/internal/store/postgres/store_test.go +++ b/central/authprovider/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *AuthProvidersStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, authProviders)) + foundAuthProviders, missing, err := store.GetMany(ctx, authProviderIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), authProviders, foundAuthProviders) + authProviderCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, authProviderCount) diff --git a/central/blob/datastore/store/postgres/store_test.go b/central/blob/datastore/store/postgres/store_test.go index 6541102514c00..db47a98749818 100644 --- a/central/blob/datastore/store/postgres/store_test.go +++ b/central/blob/datastore/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *BlobsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, blobs)) + foundBlobs, missing, err := store.GetMany(ctx, blobIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), blobs, foundBlobs) + blobCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, blobCount) diff --git a/central/cloudsources/datastore/internal/store/postgres/store_test.go b/central/cloudsources/datastore/internal/store/postgres/store_test.go index b1e0a4063e3af..42e3479aba68b 100644 --- a/central/cloudsources/datastore/internal/store/postgres/store_test.go +++ b/central/cloudsources/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *CloudSourcesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, cloudSources)) + foundCloudSources, missing, err := store.GetMany(ctx, cloudSourceIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), cloudSources, foundCloudSources) + cloudSourceCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, cloudSourceCount) diff --git a/central/cluster/store/cluster/postgres/store_test.go b/central/cluster/store/cluster/postgres/store_test.go index f99d7676802b0..685bc9393b499 100644 --- a/central/cluster/store/cluster/postgres/store_test.go +++ b/central/cluster/store/cluster/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *ClustersStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, clusters)) + foundClusters, missing, err := store.GetMany(ctx, clusterIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), clusters, foundClusters) + clusterCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, clusterCount) diff --git a/central/cluster/store/clusterhealth/postgres/store_test.go b/central/cluster/store/clusterhealth/postgres/store_test.go index cd12dfb3df25e..c8fa19a4f4e08 100644 --- a/central/cluster/store/clusterhealth/postgres/store_test.go +++ b/central/cluster/store/clusterhealth/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ClusterHealthStatusesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, clusterHealthStatuss)) + foundClusterHealthStatuss, missing, err := store.GetMany(ctx, clusterHealthStatusIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), clusterHealthStatuss, foundClusterHealthStatuss) + clusterHealthStatusCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, clusterHealthStatusCount) diff --git a/central/clusterinit/store/postgres/store_test.go b/central/clusterinit/store/postgres/store_test.go index f3f0f25cd413b..804346ba5b003 100644 --- a/central/clusterinit/store/postgres/store_test.go +++ b/central/clusterinit/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ClusterInitBundlesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, initBundleMetas)) + foundInitBundleMetas, missing, err := store.GetMany(ctx, initBundleMetaIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), initBundleMetas, foundInitBundleMetas) + initBundleMetaCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, initBundleMetaCount) diff --git a/central/compliance/datastore/internal/store/postgres/compliance_config/store_test.go b/central/compliance/datastore/internal/store/postgres/compliance_config/store_test.go index ad5f9640bd63b..ac19274095e49 100644 --- a/central/compliance/datastore/internal/store/postgres/compliance_config/store_test.go +++ b/central/compliance/datastore/internal/store/postgres/compliance_config/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceConfigsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceConfigs)) + foundComplianceConfigs, missing, err := store.GetMany(ctx, complianceConfigIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceConfigs, foundComplianceConfigs) + complianceConfigCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceConfigCount) diff --git a/central/compliance/datastore/internal/store/postgres/domain/store_test.go b/central/compliance/datastore/internal/store/postgres/domain/store_test.go index e6c95b1531d42..0d3c9097e0a4a 100644 --- a/central/compliance/datastore/internal/store/postgres/domain/store_test.go +++ b/central/compliance/datastore/internal/store/postgres/domain/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceDomainsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceDomains)) + foundComplianceDomains, missing, err := store.GetMany(ctx, complianceDomainIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceDomains, foundComplianceDomains) + complianceDomainCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceDomainCount) diff --git a/central/compliance/datastore/internal/store/postgres/metadata/store_test.go b/central/compliance/datastore/internal/store/postgres/metadata/store_test.go index 5a46717365f0b..4a606d98d4ca7 100644 --- a/central/compliance/datastore/internal/store/postgres/metadata/store_test.go +++ b/central/compliance/datastore/internal/store/postgres/metadata/store_test.go @@ -96,6 +96,11 @@ func (s *ComplianceRunMetadataStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceRunMetadatas)) + foundComplianceRunMetadatas, missing, err := store.GetMany(ctx, complianceRunMetadataIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceRunMetadatas, foundComplianceRunMetadatas) + complianceRunMetadataCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceRunMetadataCount) diff --git a/central/compliance/datastore/internal/store/postgres/results/store_test.go b/central/compliance/datastore/internal/store/postgres/results/store_test.go index 7a4bac8ff84a9..4f4ef3c156676 100644 --- a/central/compliance/datastore/internal/store/postgres/results/store_test.go +++ b/central/compliance/datastore/internal/store/postgres/results/store_test.go @@ -96,6 +96,11 @@ func (s *ComplianceRunResultsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceRunResultss)) + foundComplianceRunResultss, missing, err := store.GetMany(ctx, complianceRunResultsIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceRunResultss, foundComplianceRunResultss) + complianceRunResultsCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceRunResultsCount) diff --git a/central/compliance/datastore/internal/store/postgres/strings/store_test.go b/central/compliance/datastore/internal/store/postgres/strings/store_test.go index 379d4c5e7d062..1af1a155f5f52 100644 --- a/central/compliance/datastore/internal/store/postgres/strings/store_test.go +++ b/central/compliance/datastore/internal/store/postgres/strings/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceStringsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceStringss)) + foundComplianceStringss, missing, err := store.GetMany(ctx, complianceStringsIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceStringss, foundComplianceStringss) + complianceStringsCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceStringsCount) diff --git a/central/complianceoperator/checkresults/store/postgres/store_test.go b/central/complianceoperator/checkresults/store/postgres/store_test.go index 611857e7822df..d8e5816ce0036 100644 --- a/central/complianceoperator/checkresults/store/postgres/store_test.go +++ b/central/complianceoperator/checkresults/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceOperatorCheckResultsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorCheckResults)) + foundComplianceOperatorCheckResults, missing, err := store.GetMany(ctx, complianceOperatorCheckResultIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorCheckResults, foundComplianceOperatorCheckResults) + complianceOperatorCheckResultCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorCheckResultCount) diff --git a/central/complianceoperator/profiles/store/postgres/store_test.go b/central/complianceoperator/profiles/store/postgres/store_test.go index a7e8a57ef1d42..1c8173fed533a 100644 --- a/central/complianceoperator/profiles/store/postgres/store_test.go +++ b/central/complianceoperator/profiles/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceOperatorProfilesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorProfiles)) + foundComplianceOperatorProfiles, missing, err := store.GetMany(ctx, complianceOperatorProfileIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorProfiles, foundComplianceOperatorProfiles) + complianceOperatorProfileCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorProfileCount) diff --git a/central/complianceoperator/rules/store/postgres/store_test.go b/central/complianceoperator/rules/store/postgres/store_test.go index 6c5833a3eff37..f3bff78d40b7d 100644 --- a/central/complianceoperator/rules/store/postgres/store_test.go +++ b/central/complianceoperator/rules/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceOperatorRulesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorRules)) + foundComplianceOperatorRules, missing, err := store.GetMany(ctx, complianceOperatorRuleIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorRules, foundComplianceOperatorRules) + complianceOperatorRuleCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorRuleCount) diff --git a/central/complianceoperator/scans/store/postgres/store_test.go b/central/complianceoperator/scans/store/postgres/store_test.go index 0e3b56502311f..cba1d4bb60c3f 100644 --- a/central/complianceoperator/scans/store/postgres/store_test.go +++ b/central/complianceoperator/scans/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceOperatorScansStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorScans)) + foundComplianceOperatorScans, missing, err := store.GetMany(ctx, complianceOperatorScanIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorScans, foundComplianceOperatorScans) + complianceOperatorScanCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorScanCount) diff --git a/central/complianceoperator/scansettingbinding/store/postgres/store_test.go b/central/complianceoperator/scansettingbinding/store/postgres/store_test.go index aa8446f4fa9f1..5638fae2c53f2 100644 --- a/central/complianceoperator/scansettingbinding/store/postgres/store_test.go +++ b/central/complianceoperator/scansettingbinding/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ComplianceOperatorScanSettingBindingsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorScanSettingBindings)) + foundComplianceOperatorScanSettingBindings, missing, err := store.GetMany(ctx, complianceOperatorScanSettingBindingIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorScanSettingBindings, foundComplianceOperatorScanSettingBindings) + complianceOperatorScanSettingBindingCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorScanSettingBindingCount) diff --git a/central/complianceoperator/v2/benchmarks/store/postgres/store_test.go b/central/complianceoperator/v2/benchmarks/store/postgres/store_test.go index 5d90716e1aca7..f21b84bdb888d 100644 --- a/central/complianceoperator/v2/benchmarks/store/postgres/store_test.go +++ b/central/complianceoperator/v2/benchmarks/store/postgres/store_test.go @@ -100,6 +100,11 @@ func (s *ComplianceOperatorBenchmarkV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorBenchmarkV2s)) + foundComplianceOperatorBenchmarkV2s, missing, err := store.GetMany(ctx, complianceOperatorBenchmarkV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorBenchmarkV2s, foundComplianceOperatorBenchmarkV2s) + complianceOperatorBenchmarkV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorBenchmarkV2Count) diff --git a/central/complianceoperator/v2/checkresults/store/postgres/store_test.go b/central/complianceoperator/v2/checkresults/store/postgres/store_test.go index 908d2628fa1c6..cfaf51ee43bd0 100644 --- a/central/complianceoperator/v2/checkresults/store/postgres/store_test.go +++ b/central/complianceoperator/v2/checkresults/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorCheckResultV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorCheckResultV2s)) + foundComplianceOperatorCheckResultV2s, missing, err := store.GetMany(ctx, complianceOperatorCheckResultV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorCheckResultV2s, foundComplianceOperatorCheckResultV2s) + complianceOperatorCheckResultV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorCheckResultV2Count) diff --git a/central/complianceoperator/v2/integration/store/postgres/store_test.go b/central/complianceoperator/v2/integration/store/postgres/store_test.go index 608a14836e2d7..eedf17284b58b 100644 --- a/central/complianceoperator/v2/integration/store/postgres/store_test.go +++ b/central/complianceoperator/v2/integration/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *ComplianceIntegrationsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceIntegrations)) + foundComplianceIntegrations, missing, err := store.GetMany(ctx, complianceIntegrationIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceIntegrations, foundComplianceIntegrations) + complianceIntegrationCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceIntegrationCount) diff --git a/central/complianceoperator/v2/profiles/store/postgres/store_test.go b/central/complianceoperator/v2/profiles/store/postgres/store_test.go index 88e1d9f86b251..7891647e044a2 100644 --- a/central/complianceoperator/v2/profiles/store/postgres/store_test.go +++ b/central/complianceoperator/v2/profiles/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorProfileV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorProfileV2s)) + foundComplianceOperatorProfileV2s, missing, err := store.GetMany(ctx, complianceOperatorProfileV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorProfileV2s, foundComplianceOperatorProfileV2s) + complianceOperatorProfileV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorProfileV2Count) diff --git a/central/complianceoperator/v2/remediations/store/postgres/store_test.go b/central/complianceoperator/v2/remediations/store/postgres/store_test.go index afb038c561ac7..fa3a3f9ac06f7 100644 --- a/central/complianceoperator/v2/remediations/store/postgres/store_test.go +++ b/central/complianceoperator/v2/remediations/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorRemediationV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorRemediationV2s)) + foundComplianceOperatorRemediationV2s, missing, err := store.GetMany(ctx, complianceOperatorRemediationV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorRemediationV2s, foundComplianceOperatorRemediationV2s) + complianceOperatorRemediationV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorRemediationV2Count) diff --git a/central/complianceoperator/v2/rules/store/postgres/store_test.go b/central/complianceoperator/v2/rules/store/postgres/store_test.go index d2ab8a615eb30..5092a11d863cf 100644 --- a/central/complianceoperator/v2/rules/store/postgres/store_test.go +++ b/central/complianceoperator/v2/rules/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorRuleV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorRuleV2s)) + foundComplianceOperatorRuleV2s, missing, err := store.GetMany(ctx, complianceOperatorRuleV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorRuleV2s, foundComplianceOperatorRuleV2s) + complianceOperatorRuleV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorRuleV2Count) diff --git a/central/complianceoperator/v2/scanconfigurations/scanconfigstatus/store/postgres/store_test.go b/central/complianceoperator/v2/scanconfigurations/scanconfigstatus/store/postgres/store_test.go index 7e93c544bd0c8..c2a6b9df83cc5 100644 --- a/central/complianceoperator/v2/scanconfigurations/scanconfigstatus/store/postgres/store_test.go +++ b/central/complianceoperator/v2/scanconfigurations/scanconfigstatus/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorClusterScanConfigStatusesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorClusterScanConfigStatuss)) + foundComplianceOperatorClusterScanConfigStatuss, missing, err := store.GetMany(ctx, complianceOperatorClusterScanConfigStatusIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorClusterScanConfigStatuss, foundComplianceOperatorClusterScanConfigStatuss) + complianceOperatorClusterScanConfigStatusCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorClusterScanConfigStatusCount) diff --git a/central/complianceoperator/v2/scanconfigurations/store/postgres/store_test.go b/central/complianceoperator/v2/scanconfigurations/store/postgres/store_test.go index 03292991e6a89..e827aae1e1c73 100644 --- a/central/complianceoperator/v2/scanconfigurations/store/postgres/store_test.go +++ b/central/complianceoperator/v2/scanconfigurations/store/postgres/store_test.go @@ -100,6 +100,11 @@ func (s *ComplianceOperatorScanConfigurationV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorScanConfigurationV2s)) + foundComplianceOperatorScanConfigurationV2s, missing, err := store.GetMany(ctx, complianceOperatorScanConfigurationV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorScanConfigurationV2s, foundComplianceOperatorScanConfigurationV2s) + complianceOperatorScanConfigurationV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorScanConfigurationV2Count) diff --git a/central/complianceoperator/v2/scans/store/postgres/store_test.go b/central/complianceoperator/v2/scans/store/postgres/store_test.go index ddb869749e7bb..a07ec305b752b 100644 --- a/central/complianceoperator/v2/scans/store/postgres/store_test.go +++ b/central/complianceoperator/v2/scans/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorScanV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorScanV2s)) + foundComplianceOperatorScanV2s, missing, err := store.GetMany(ctx, complianceOperatorScanV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorScanV2s, foundComplianceOperatorScanV2s) + complianceOperatorScanV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorScanV2Count) diff --git a/central/complianceoperator/v2/scansettingbindings/store/postgres/store_test.go b/central/complianceoperator/v2/scansettingbindings/store/postgres/store_test.go index c56fdb87f5464..fc1a3e4f4eba0 100644 --- a/central/complianceoperator/v2/scansettingbindings/store/postgres/store_test.go +++ b/central/complianceoperator/v2/scansettingbindings/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorScanSettingBindingV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorScanSettingBindingV2s)) + foundComplianceOperatorScanSettingBindingV2s, missing, err := store.GetMany(ctx, complianceOperatorScanSettingBindingV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorScanSettingBindingV2s, foundComplianceOperatorScanSettingBindingV2s) + complianceOperatorScanSettingBindingV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorScanSettingBindingV2Count) diff --git a/central/complianceoperator/v2/suites/store/postgres/store_test.go b/central/complianceoperator/v2/suites/store/postgres/store_test.go index a59a429efb2df..da532287f69b4 100644 --- a/central/complianceoperator/v2/suites/store/postgres/store_test.go +++ b/central/complianceoperator/v2/suites/store/postgres/store_test.go @@ -103,6 +103,11 @@ func (s *ComplianceOperatorSuiteV2StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, complianceOperatorSuiteV2s)) + foundComplianceOperatorSuiteV2s, missing, err := store.GetMany(ctx, complianceOperatorSuiteV2IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), complianceOperatorSuiteV2s, foundComplianceOperatorSuiteV2s) + complianceOperatorSuiteV2Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, complianceOperatorSuiteV2Count) diff --git a/central/cve/cluster/datastore/store/postgres/store_test.go b/central/cve/cluster/datastore/store/postgres/store_test.go index b289a1b975bdf..66ce04416ffbb 100644 --- a/central/cve/cluster/datastore/store/postgres/store_test.go +++ b/central/cve/cluster/datastore/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ClusterCvesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, clusterCVEs)) + foundClusterCVEs, missing, err := store.GetMany(ctx, clusterCVEIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), clusterCVEs, foundClusterCVEs) + clusterCVECount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, clusterCVECount) diff --git a/central/cve/image/datastore/store/postgres/store_test.go b/central/cve/image/datastore/store/postgres/store_test.go index 448eff02cdfe7..7475d2da53433 100644 --- a/central/cve/image/datastore/store/postgres/store_test.go +++ b/central/cve/image/datastore/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ImageCvesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, imageCVEs)) + foundImageCVEs, missing, err := store.GetMany(ctx, imageCVEIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), imageCVEs, foundImageCVEs) + imageCVECount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, imageCVECount) diff --git a/central/cve/node/datastore/store/postgres/store_test.go b/central/cve/node/datastore/store/postgres/store_test.go index e514a769ca9ba..01005fe5d9eff 100644 --- a/central/cve/node/datastore/store/postgres/store_test.go +++ b/central/cve/node/datastore/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *NodeCvesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, nodeCVEs)) + foundNodeCVEs, missing, err := store.GetMany(ctx, nodeCVEIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), nodeCVEs, foundNodeCVEs) + nodeCVECount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, nodeCVECount) diff --git a/central/declarativeconfig/health/datastore/store/postgres/store_test.go b/central/declarativeconfig/health/datastore/store/postgres/store_test.go index a67e71f9ef19b..88d3aab9c8524 100644 --- a/central/declarativeconfig/health/datastore/store/postgres/store_test.go +++ b/central/declarativeconfig/health/datastore/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *DeclarativeConfigHealthsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, declarativeConfigHealths)) + foundDeclarativeConfigHealths, missing, err := store.GetMany(ctx, declarativeConfigHealthIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), declarativeConfigHealths, foundDeclarativeConfigHealths) + declarativeConfigHealthCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, declarativeConfigHealthCount) diff --git a/central/deployment/datastore/internal/store/postgres/store_test.go b/central/deployment/datastore/internal/store/postgres/store_test.go index 9ccab4a4ffb46..cbac85dbecd22 100644 --- a/central/deployment/datastore/internal/store/postgres/store_test.go +++ b/central/deployment/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *DeploymentsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, deployments)) + foundDeployments, missing, err := store.GetMany(ctx, deploymentIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), deployments, foundDeployments) + deploymentCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, deploymentCount) diff --git a/central/discoveredclusters/datastore/internal/store/postgres/store_test.go b/central/discoveredclusters/datastore/internal/store/postgres/store_test.go index 15dfef71846fe..db9c1fafeaae8 100644 --- a/central/discoveredclusters/datastore/internal/store/postgres/store_test.go +++ b/central/discoveredclusters/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *DiscoveredClustersStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, discoveredClusters)) + foundDiscoveredClusters, missing, err := store.GetMany(ctx, discoveredClusterIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), discoveredClusters, foundDiscoveredClusters) + discoveredClusterCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, discoveredClusterCount) diff --git a/central/externalbackups/internal/store/postgres/store_test.go b/central/externalbackups/internal/store/postgres/store_test.go index d3882103ecb46..8403436e5411f 100644 --- a/central/externalbackups/internal/store/postgres/store_test.go +++ b/central/externalbackups/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ExternalBackupsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, externalBackups)) + foundExternalBackups, missing, err := store.GetMany(ctx, externalBackupIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), externalBackups, foundExternalBackups) + externalBackupCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, externalBackupCount) diff --git a/central/group/datastore/internal/store/postgres/store_test.go b/central/group/datastore/internal/store/postgres/store_test.go index 99c6e16ce6a55..f21ea261ea037 100644 --- a/central/group/datastore/internal/store/postgres/store_test.go +++ b/central/group/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *GroupsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, groups)) + foundGroups, missing, err := store.GetMany(ctx, groupIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), groups, foundGroups) + groupCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, groupCount) diff --git a/central/hash/datastore/store/postgres/store_test.go b/central/hash/datastore/store/postgres/store_test.go index 761a881abd426..153386e3ac05e 100644 --- a/central/hash/datastore/store/postgres/store_test.go +++ b/central/hash/datastore/store/postgres/store_test.go @@ -100,6 +100,11 @@ func (s *HashesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, hashs)) + foundHashs, missing, err := store.GetMany(ctx, hashIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), hashs, foundHashs) + hashCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, hashCount) diff --git a/central/imagecomponent/datastore/store/postgres/store_test.go b/central/imagecomponent/datastore/store/postgres/store_test.go index a4d2a8d73a10b..3e1bba78257ce 100644 --- a/central/imagecomponent/datastore/store/postgres/store_test.go +++ b/central/imagecomponent/datastore/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ImageComponentsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, imageComponents)) + foundImageComponents, missing, err := store.GetMany(ctx, imageComponentIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), imageComponents, foundImageComponents) + imageComponentCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, imageComponentCount) diff --git a/central/imageintegration/store/postgres/store_test.go b/central/imageintegration/store/postgres/store_test.go index a7ea2d5380710..6794a9ffc802e 100644 --- a/central/imageintegration/store/postgres/store_test.go +++ b/central/imageintegration/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ImageIntegrationsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, imageIntegrations)) + foundImageIntegrations, missing, err := store.GetMany(ctx, imageIntegrationIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), imageIntegrations, foundImageIntegrations) + imageIntegrationCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, imageIntegrationCount) diff --git a/central/integrationhealth/store/postgres/store_test.go b/central/integrationhealth/store/postgres/store_test.go index e193f2adacd9f..fc59cb4b15c8b 100644 --- a/central/integrationhealth/store/postgres/store_test.go +++ b/central/integrationhealth/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *IntegrationHealthsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, integrationHealths)) + foundIntegrationHealths, missing, err := store.GetMany(ctx, integrationHealthIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), integrationHealths, foundIntegrationHealths) + integrationHealthCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, integrationHealthCount) diff --git a/central/logimbue/store/postgres/store_test.go b/central/logimbue/store/postgres/store_test.go index 1da8efd0481f3..3b50cc6b5ef45 100644 --- a/central/logimbue/store/postgres/store_test.go +++ b/central/logimbue/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *LogImbuesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, logImbues)) + foundLogImbues, missing, err := store.GetMany(ctx, logImbueIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), logImbues, foundLogImbues) + logImbueCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, logImbueCount) diff --git a/central/namespace/datastore/internal/store/postgres/store_test.go b/central/namespace/datastore/internal/store/postgres/store_test.go index bc430dfa42b5f..676e720c403dd 100644 --- a/central/namespace/datastore/internal/store/postgres/store_test.go +++ b/central/namespace/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *NamespacesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, namespaceMetadatas)) + foundNamespaceMetadatas, missing, err := store.GetMany(ctx, namespaceMetadataIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), namespaceMetadatas, foundNamespaceMetadatas) + namespaceMetadataCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, namespaceMetadataCount) diff --git a/central/networkbaseline/store/postgres/store_test.go b/central/networkbaseline/store/postgres/store_test.go index 342004c84954f..53bb093aecbb5 100644 --- a/central/networkbaseline/store/postgres/store_test.go +++ b/central/networkbaseline/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *NetworkBaselinesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, networkBaselines)) + foundNetworkBaselines, missing, err := store.GetMany(ctx, networkBaselineIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), networkBaselines, foundNetworkBaselines) + networkBaselineCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, networkBaselineCount) diff --git a/central/networkgraph/config/datastore/internal/store/postgres/store_test.go b/central/networkgraph/config/datastore/internal/store/postgres/store_test.go index 6d7e8993067ae..64cd0d7f97465 100644 --- a/central/networkgraph/config/datastore/internal/store/postgres/store_test.go +++ b/central/networkgraph/config/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *NetworkGraphConfigsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, networkGraphConfigs)) + foundNetworkGraphConfigs, missing, err := store.GetMany(ctx, networkGraphConfigIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), networkGraphConfigs, foundNetworkGraphConfigs) + networkGraphConfigCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, networkGraphConfigCount) diff --git a/central/networkgraph/entity/datastore/internal/store/postgres/store_test.go b/central/networkgraph/entity/datastore/internal/store/postgres/store_test.go index 138a9825261de..0ea3fe69fab93 100644 --- a/central/networkgraph/entity/datastore/internal/store/postgres/store_test.go +++ b/central/networkgraph/entity/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *NetworkEntitiesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, networkEntitys)) + foundNetworkEntitys, missing, err := store.GetMany(ctx, networkEntityIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), networkEntitys, foundNetworkEntitys) + networkEntityCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, networkEntityCount) diff --git a/central/networkpolicies/datastore/internal/store/postgres/store_test.go b/central/networkpolicies/datastore/internal/store/postgres/store_test.go index 7e1a52eae396c..8dcea28c960db 100644 --- a/central/networkpolicies/datastore/internal/store/postgres/store_test.go +++ b/central/networkpolicies/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *NetworkpoliciesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, networkPolicys)) + foundNetworkPolicys, missing, err := store.GetMany(ctx, networkPolicyIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), networkPolicys, foundNetworkPolicys) + networkPolicyCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, networkPolicyCount) diff --git a/central/networkpolicies/datastore/internal/undodeploymentstore/postgres/store_test.go b/central/networkpolicies/datastore/internal/undodeploymentstore/postgres/store_test.go index da235c1a82f12..3be7f21d69060 100644 --- a/central/networkpolicies/datastore/internal/undodeploymentstore/postgres/store_test.go +++ b/central/networkpolicies/datastore/internal/undodeploymentstore/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *NetworkpoliciesundodeploymentsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, networkPolicyApplicationUndoDeploymentRecords)) + foundNetworkPolicyApplicationUndoDeploymentRecords, missing, err := store.GetMany(ctx, networkPolicyApplicationUndoDeploymentRecordIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), networkPolicyApplicationUndoDeploymentRecords, foundNetworkPolicyApplicationUndoDeploymentRecords) + networkPolicyApplicationUndoDeploymentRecordCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, networkPolicyApplicationUndoDeploymentRecordCount) diff --git a/central/networkpolicies/datastore/internal/undostore/postgres/store_test.go b/central/networkpolicies/datastore/internal/undostore/postgres/store_test.go index a1b69b8aeed14..b15c660040098 100644 --- a/central/networkpolicies/datastore/internal/undostore/postgres/store_test.go +++ b/central/networkpolicies/datastore/internal/undostore/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *NetworkpolicyapplicationundorecordsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, networkPolicyApplicationUndoRecords)) + foundNetworkPolicyApplicationUndoRecords, missing, err := store.GetMany(ctx, networkPolicyApplicationUndoRecordIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), networkPolicyApplicationUndoRecords, foundNetworkPolicyApplicationUndoRecords) + networkPolicyApplicationUndoRecordCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, networkPolicyApplicationUndoRecordCount) diff --git a/central/nodecomponent/datastore/store/postgres/store_test.go b/central/nodecomponent/datastore/store/postgres/store_test.go index 41751f67c3062..15f9e14682414 100644 --- a/central/nodecomponent/datastore/store/postgres/store_test.go +++ b/central/nodecomponent/datastore/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *NodeComponentsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, nodeComponents)) + foundNodeComponents, missing, err := store.GetMany(ctx, nodeComponentIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), nodeComponents, foundNodeComponents) + nodeComponentCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, nodeComponentCount) diff --git a/central/notifier/datastore/internal/store/postgres/store_test.go b/central/notifier/datastore/internal/store/postgres/store_test.go index dd9ff58480e91..bcf7a73a33952 100644 --- a/central/notifier/datastore/internal/store/postgres/store_test.go +++ b/central/notifier/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *NotifiersStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, notifiers)) + foundNotifiers, missing, err := store.GetMany(ctx, notifierIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), notifiers, foundNotifiers) + notifierCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, notifierCount) diff --git a/central/pod/datastore/internal/store/postgres/store_test.go b/central/pod/datastore/internal/store/postgres/store_test.go index 126e15cb45a3e..284e850d1bcd1 100644 --- a/central/pod/datastore/internal/store/postgres/store_test.go +++ b/central/pod/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *PodsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, pods)) + foundPods, missing, err := store.GetMany(ctx, podIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), pods, foundPods) + podCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, podCount) diff --git a/central/policy/store/postgres/store_test.go b/central/policy/store/postgres/store_test.go index d98c53d0d596f..24f1fc4f16b4b 100644 --- a/central/policy/store/postgres/store_test.go +++ b/central/policy/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *PoliciesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, policys)) + foundPolicys, missing, err := store.GetMany(ctx, policyIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), policys, foundPolicys) + policyCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, policyCount) diff --git a/central/policycategory/store/postgres/store_test.go b/central/policycategory/store/postgres/store_test.go index 3c9bba9d91780..1171223ca176d 100644 --- a/central/policycategory/store/postgres/store_test.go +++ b/central/policycategory/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *PolicyCategoriesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, policyCategorys)) + foundPolicyCategorys, missing, err := store.GetMany(ctx, policyCategoryIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), policyCategorys, foundPolicyCategorys) + policyCategoryCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, policyCategoryCount) diff --git a/central/processbaseline/store/postgres/store_test.go b/central/processbaseline/store/postgres/store_test.go index 7f388cea4a685..321bc7a1d3baf 100644 --- a/central/processbaseline/store/postgres/store_test.go +++ b/central/processbaseline/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *ProcessBaselinesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, processBaselines)) + foundProcessBaselines, missing, err := store.GetMany(ctx, processBaselineIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), processBaselines, foundProcessBaselines) + processBaselineCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, processBaselineCount) diff --git a/central/processbaselineresults/datastore/internal/store/postgres/store_test.go b/central/processbaselineresults/datastore/internal/store/postgres/store_test.go index 6edc02b07d956..7495100cefdc0 100644 --- a/central/processbaselineresults/datastore/internal/store/postgres/store_test.go +++ b/central/processbaselineresults/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *ProcessBaselineResultsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, processBaselineResultss)) + foundProcessBaselineResultss, missing, err := store.GetMany(ctx, processBaselineResultsIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), processBaselineResultss, foundProcessBaselineResultss) + processBaselineResultsCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, processBaselineResultsCount) diff --git a/central/processindicator/store/postgres/store_test.go b/central/processindicator/store/postgres/store_test.go index 29319eae8ccff..5d7acdce35419 100644 --- a/central/processindicator/store/postgres/store_test.go +++ b/central/processindicator/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *ProcessIndicatorsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, processIndicators)) + foundProcessIndicators, missing, err := store.GetMany(ctx, processIndicatorIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), processIndicators, foundProcessIndicators) + processIndicatorCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, processIndicatorCount) diff --git a/central/processlisteningonport/store/postgres/store_test.go b/central/processlisteningonport/store/postgres/store_test.go index 50f229a6c93f8..f840a252c16a3 100644 --- a/central/processlisteningonport/store/postgres/store_test.go +++ b/central/processlisteningonport/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *ListeningEndpointsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, processListeningOnPortStorages)) + foundProcessListeningOnPortStorages, missing, err := store.GetMany(ctx, processListeningOnPortStorageIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), processListeningOnPortStorages, foundProcessListeningOnPortStorages) + processListeningOnPortStorageCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, processListeningOnPortStorageCount) diff --git a/central/rbac/k8srole/internal/store/postgres/store_test.go b/central/rbac/k8srole/internal/store/postgres/store_test.go index f2cdf0bca6e21..4c8f913f731d9 100644 --- a/central/rbac/k8srole/internal/store/postgres/store_test.go +++ b/central/rbac/k8srole/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *K8sRolesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, k8SRoles)) + foundK8SRoles, missing, err := store.GetMany(ctx, k8SRoleIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), k8SRoles, foundK8SRoles) + k8SRoleCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, k8SRoleCount) diff --git a/central/rbac/k8srolebinding/internal/store/postgres/store_test.go b/central/rbac/k8srolebinding/internal/store/postgres/store_test.go index 306f989a042f0..5293d8f9aba53 100644 --- a/central/rbac/k8srolebinding/internal/store/postgres/store_test.go +++ b/central/rbac/k8srolebinding/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *RoleBindingsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, k8SRoleBindings)) + foundK8SRoleBindings, missing, err := store.GetMany(ctx, k8SRoleBindingIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), k8SRoleBindings, foundK8SRoleBindings) + k8SRoleBindingCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, k8SRoleBindingCount) diff --git a/central/reports/config/store/postgres/store_test.go b/central/reports/config/store/postgres/store_test.go index 6661877135795..c5691bbcc7cb6 100644 --- a/central/reports/config/store/postgres/store_test.go +++ b/central/reports/config/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ReportConfigurationsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, reportConfigurations)) + foundReportConfigurations, missing, err := store.GetMany(ctx, reportConfigurationIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), reportConfigurations, foundReportConfigurations) + reportConfigurationCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, reportConfigurationCount) diff --git a/central/resourcecollection/datastore/store/postgres/store_test.go b/central/resourcecollection/datastore/store/postgres/store_test.go index c5147ea5a2e71..47459557aa261 100644 --- a/central/resourcecollection/datastore/store/postgres/store_test.go +++ b/central/resourcecollection/datastore/store/postgres/store_test.go @@ -95,6 +95,11 @@ func (s *CollectionsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, resourceCollections)) + foundResourceCollections, missing, err := store.GetMany(ctx, resourceCollectionIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), resourceCollections, foundResourceCollections) + resourceCollectionCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, resourceCollectionCount) diff --git a/central/risk/datastore/internal/store/postgres/store_test.go b/central/risk/datastore/internal/store/postgres/store_test.go index 252061b160617..9bd3b52872a1e 100644 --- a/central/risk/datastore/internal/store/postgres/store_test.go +++ b/central/risk/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *RisksStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, risks)) + foundRisks, missing, err := store.GetMany(ctx, riskIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), risks, foundRisks) + riskCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, riskCount) diff --git a/central/role/store/permissionset/postgres/store_test.go b/central/role/store/permissionset/postgres/store_test.go index 9b93c4b6df138..84fd40f230de2 100644 --- a/central/role/store/permissionset/postgres/store_test.go +++ b/central/role/store/permissionset/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *PermissionSetsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, permissionSets)) + foundPermissionSets, missing, err := store.GetMany(ctx, permissionSetIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), permissionSets, foundPermissionSets) + permissionSetCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, permissionSetCount) diff --git a/central/role/store/role/postgres/store_test.go b/central/role/store/role/postgres/store_test.go index 90c7bf8b04bec..44c0a8779909d 100644 --- a/central/role/store/role/postgres/store_test.go +++ b/central/role/store/role/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *RolesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, roles)) + foundRoles, missing, err := store.GetMany(ctx, roleIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), roles, foundRoles) + roleCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, roleCount) diff --git a/central/role/store/simpleaccessscope/postgres/store_test.go b/central/role/store/simpleaccessscope/postgres/store_test.go index d1ce10a391e48..daac4dc8f4dc3 100644 --- a/central/role/store/simpleaccessscope/postgres/store_test.go +++ b/central/role/store/simpleaccessscope/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *SimpleAccessScopesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, simpleAccessScopes)) + foundSimpleAccessScopes, missing, err := store.GetMany(ctx, simpleAccessScopeIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), simpleAccessScopes, foundSimpleAccessScopes) + simpleAccessScopeCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, simpleAccessScopeCount) diff --git a/central/secret/internal/store/postgres/store_test.go b/central/secret/internal/store/postgres/store_test.go index 6493ccd4d7006..12abd521da5d8 100644 --- a/central/secret/internal/store/postgres/store_test.go +++ b/central/secret/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *SecretsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, secrets)) + foundSecrets, missing, err := store.GetMany(ctx, secretIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), secrets, foundSecrets) + secretCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, secretCount) diff --git a/central/serviceaccount/internal/store/postgres/store_test.go b/central/serviceaccount/internal/store/postgres/store_test.go index 90cc1257b9bc2..5d992ada6aa20 100644 --- a/central/serviceaccount/internal/store/postgres/store_test.go +++ b/central/serviceaccount/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *ServiceAccountsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, serviceAccounts)) + foundServiceAccounts, missing, err := store.GetMany(ctx, serviceAccountIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), serviceAccounts, foundServiceAccounts) + serviceAccountCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, serviceAccountCount) diff --git a/central/serviceidentities/internal/store/postgres/store_test.go b/central/serviceidentities/internal/store/postgres/store_test.go index c33d214002317..222dd437bce02 100644 --- a/central/serviceidentities/internal/store/postgres/store_test.go +++ b/central/serviceidentities/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *ServiceIdentitiesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, serviceIdentitys)) + foundServiceIdentitys, missing, err := store.GetMany(ctx, serviceIdentityIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), serviceIdentitys, foundServiceIdentitys) + serviceIdentityCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, serviceIdentityCount) diff --git a/central/signatureintegration/store/postgres/store_test.go b/central/signatureintegration/store/postgres/store_test.go index adf8d4aeed1f7..0931642811713 100644 --- a/central/signatureintegration/store/postgres/store_test.go +++ b/central/signatureintegration/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *SignatureIntegrationsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, signatureIntegrations)) + foundSignatureIntegrations, missing, err := store.GetMany(ctx, signatureIntegrationIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), signatureIntegrations, foundSignatureIntegrations) + signatureIntegrationCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, signatureIntegrationCount) diff --git a/central/virtualmachine/datastore/internal/store/postgres/store_test.go b/central/virtualmachine/datastore/internal/store/postgres/store_test.go index 912026a23cc8d..47131d604d7df 100644 --- a/central/virtualmachine/datastore/internal/store/postgres/store_test.go +++ b/central/virtualmachine/datastore/internal/store/postgres/store_test.go @@ -96,6 +96,11 @@ func (s *VirtualMachinesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, virtualMachines)) + foundVirtualMachines, missing, err := store.GetMany(ctx, virtualMachineIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), virtualMachines, foundVirtualMachines) + virtualMachineCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, virtualMachineCount) diff --git a/central/vulnmgmt/vulnerabilityrequest/datastore/internal/store/postgres/store_test.go b/central/vulnmgmt/vulnerabilityrequest/datastore/internal/store/postgres/store_test.go index 02cbcc7b1bb12..b53b0b6c4e724 100644 --- a/central/vulnmgmt/vulnerabilityrequest/datastore/internal/store/postgres/store_test.go +++ b/central/vulnmgmt/vulnerabilityrequest/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *VulnerabilityRequestsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, vulnerabilityRequests)) + foundVulnerabilityRequests, missing, err := store.GetMany(ctx, vulnerabilityRequestIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), vulnerabilityRequests, foundVulnerabilityRequests) + vulnerabilityRequestCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, vulnerabilityRequestCount) diff --git a/central/watchedimage/datastore/internal/store/postgres/store_test.go b/central/watchedimage/datastore/internal/store/postgres/store_test.go index d30162a3f612a..e088ab1c34c74 100644 --- a/central/watchedimage/datastore/internal/store/postgres/store_test.go +++ b/central/watchedimage/datastore/internal/store/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *WatchedImagesStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, watchedImages)) + foundWatchedImages, missing, err := store.GetMany(ctx, watchedImageIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), watchedImages, foundWatchedImages) + watchedImageCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, watchedImageCount) diff --git a/tools/generate-helpers/pg-table-bindings/multitest/postgres/store_test.go b/tools/generate-helpers/pg-table-bindings/multitest/postgres/store_test.go index 15e63c4925219..a56b9c3249d21 100644 --- a/tools/generate-helpers/pg-table-bindings/multitest/postgres/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/multitest/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *TestStructsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testStructs)) + foundTestStructs, missing, err := store.GetMany(ctx, testStructIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testStructs, foundTestStructs) + testStructCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testStructCount) diff --git a/tools/generate-helpers/pg-table-bindings/store_test.go.tpl b/tools/generate-helpers/pg-table-bindings/store_test.go.tpl index 15bc6fdbca869..3b7b26e424c17 100644 --- a/tools/generate-helpers/pg-table-bindings/store_test.go.tpl +++ b/tools/generate-helpers/pg-table-bindings/store_test.go.tpl @@ -128,6 +128,11 @@ func (s *{{$namePrefix}}StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, {{.TrimmedType|lowerCamelCase}}s)) + found{{.TrimmedType|upperCamelCase}}s, missing, err := store.GetMany(ctx, {{$name}}IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), {{.TrimmedType|lowerCamelCase}}s, found{{.TrimmedType|upperCamelCase}}s) + {{.TrimmedType|lowerCamelCase}}Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, {{.TrimmedType|lowerCamelCase}}Count) diff --git a/tools/generate-helpers/pg-table-bindings/test/postgres/store_test.go b/tools/generate-helpers/pg-table-bindings/test/postgres/store_test.go index 740c1c58e61d1..26bd4aa25ff64 100644 --- a/tools/generate-helpers/pg-table-bindings/test/postgres/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/test/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *TestSingleKeyStructsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testSingleKeyStructs)) + foundTestSingleKeyStructs, missing, err := store.GetMany(ctx, testSingleKeyStructIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testSingleKeyStructs, foundTestSingleKeyStructs) + testSingleKeyStructCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testSingleKeyStructCount) diff --git a/tools/generate-helpers/pg-table-bindings/testgraphtables/testchild1/store_test.go b/tools/generate-helpers/pg-table-bindings/testgraphtables/testchild1/store_test.go index 4bafcea0bcc49..d02f960a65efc 100644 --- a/tools/generate-helpers/pg-table-bindings/testgraphtables/testchild1/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/testgraphtables/testchild1/store_test.go @@ -93,6 +93,11 @@ func (s *TestChild1StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testChild1s)) + foundTestChild1s, missing, err := store.GetMany(ctx, testChild1IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testChild1s, foundTestChild1s) + testChild1Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testChild1Count) diff --git a/tools/generate-helpers/pg-table-bindings/testgraphtables/testg3grandchild1/store_test.go b/tools/generate-helpers/pg-table-bindings/testgraphtables/testg3grandchild1/store_test.go index bce86565b125d..3e481eba31d63 100644 --- a/tools/generate-helpers/pg-table-bindings/testgraphtables/testg3grandchild1/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/testgraphtables/testg3grandchild1/store_test.go @@ -93,6 +93,11 @@ func (s *TestG3GrandChild1StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testG3GrandChild1s)) + foundTestG3GrandChild1s, missing, err := store.GetMany(ctx, testG3GrandChild1IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testG3GrandChild1s, foundTestG3GrandChild1s) + testG3GrandChild1Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testG3GrandChild1Count) diff --git a/tools/generate-helpers/pg-table-bindings/testgraphtables/testggrandchild1/store_test.go b/tools/generate-helpers/pg-table-bindings/testgraphtables/testggrandchild1/store_test.go index 471fc17cf1dc3..3d5ea7cc4e414 100644 --- a/tools/generate-helpers/pg-table-bindings/testgraphtables/testggrandchild1/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/testgraphtables/testggrandchild1/store_test.go @@ -93,6 +93,11 @@ func (s *TestGGrandChild1StoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testGGrandChild1s)) + foundTestGGrandChild1s, missing, err := store.GetMany(ctx, testGGrandChild1IDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testGGrandChild1s, foundTestGGrandChild1s) + testGGrandChild1Count, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testGGrandChild1Count) diff --git a/tools/generate-helpers/pg-table-bindings/testgraphtables/testgrandparent/store_test.go b/tools/generate-helpers/pg-table-bindings/testgraphtables/testgrandparent/store_test.go index eaf2b29276b6a..b73bb988c4a29 100644 --- a/tools/generate-helpers/pg-table-bindings/testgraphtables/testgrandparent/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/testgraphtables/testgrandparent/store_test.go @@ -93,6 +93,11 @@ func (s *TestGrandparentsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testGrandparents)) + foundTestGrandparents, missing, err := store.GetMany(ctx, testGrandparentIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testGrandparents, foundTestGrandparents) + testGrandparentCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testGrandparentCount) diff --git a/tools/generate-helpers/pg-table-bindings/testgraphtables/testshortcircuit/store_test.go b/tools/generate-helpers/pg-table-bindings/testgraphtables/testshortcircuit/store_test.go index 2f4bcf6e7c33d..42ad55b9fc1c4 100644 --- a/tools/generate-helpers/pg-table-bindings/testgraphtables/testshortcircuit/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/testgraphtables/testshortcircuit/store_test.go @@ -93,6 +93,11 @@ func (s *TestShortCircuitsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testShortCircuits)) + foundTestShortCircuits, missing, err := store.GetMany(ctx, testShortCircuitIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testShortCircuits, foundTestShortCircuits) + testShortCircuitCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testShortCircuitCount) diff --git a/tools/generate-helpers/pg-table-bindings/testuuidkey/postgres/store_test.go b/tools/generate-helpers/pg-table-bindings/testuuidkey/postgres/store_test.go index f74d0b48678ab..da8fb307b0bb4 100644 --- a/tools/generate-helpers/pg-table-bindings/testuuidkey/postgres/store_test.go +++ b/tools/generate-helpers/pg-table-bindings/testuuidkey/postgres/store_test.go @@ -93,6 +93,11 @@ func (s *TestSingleUUIDKeyStructsStoreSuite) TestStore() { s.NoError(store.UpsertMany(ctx, testSingleUUIDKeyStructs)) + foundTestSingleUUIDKeyStructs, missing, err := store.GetMany(ctx, testSingleUUIDKeyStructIDs) + s.NoError(err) + s.Empty(missing) + protoassert.ElementsMatch(s.T(), testSingleUUIDKeyStructs, foundTestSingleUUIDKeyStructs) + testSingleUUIDKeyStructCount, err = store.Count(ctx, search.EmptyQuery()) s.NoError(err) s.Equal(200, testSingleUUIDKeyStructCount)