diff --git a/example/freight_service_test.go b/example/freight_service_test.go index 8f8bd467..b9ed569a 100644 --- a/example/freight_service_test.go +++ b/example/freight_service_test.go @@ -51,3 +51,22 @@ func Test_FreightService(t *testing.T) { }, }) } + +func Test_FreightService_AlternativeSetup(t *testing.T) { + // Even though no implementation exists, the tests will pass but be skipped. + examplefreightv1.TestFreightService(t, &aipTests{}) +} + +type aipTests struct{} + +var _ examplefreightv1.FreightServiceTestSuiteConfigProvider = &aipTests{} + +func (a aipTests) ShipperTestSuiteConfig(_ *testing.T) *examplefreightv1.FreightServiceShipperTestSuiteConfig { + // Returns nil to indicate that it's not ready to be tested. + return nil +} + +func (a aipTests) SiteTestSuiteConfig(_ *testing.T) *examplefreightv1.FreightServiceSiteTestSuiteConfig { + // Returns nil to indicate that it's not ready to be tested. + return nil +} diff --git a/internal/plugin/name.go b/internal/plugin/name.go index 98fa2433..4f5b4e1b 100644 --- a/internal/plugin/name.go +++ b/internal/plugin/name.go @@ -14,9 +14,20 @@ func serviceTestSuiteName(service protoreflect.ServiceDescriptor) string { return string(service.Name()) + "TestSuite" } +func serviceResourceName( + service protoreflect.ServiceDescriptor, + resource *annotations.ResourceDescriptor, +) string { + return string(service.Name()) + resourceType(resource) +} + func resourceTestSuiteConfigName( service protoreflect.ServiceDescriptor, resource *annotations.ResourceDescriptor, ) string { - return string(service.Name()) + resourceType(resource) + "TestSuiteConfig" + return serviceResourceName(service, resource) + "TestSuiteConfig" +} + +func serviceTestConfigSupplierName(service protoreflect.ServiceDescriptor) string { + return string(service.Name()) + "TestSuiteConfigProvider" } diff --git a/internal/plugin/service.go b/internal/plugin/service.go index 707017ec..72955626 100644 --- a/internal/plugin/service.go +++ b/internal/plugin/service.go @@ -14,6 +14,9 @@ type serviceGenerator struct { } func (s *serviceGenerator) Generate(f *protogen.GeneratedFile) error { + s.generateConfigProvider(f) + s.generateMainTestFunction(f) + s.generateTestFunctions(f) s.generateFixture(f) s.generateTestMethods(f) for i, resource := range s.resources { @@ -30,6 +33,74 @@ func (s *serviceGenerator) Generate(f *protogen.GeneratedFile) error { return nil } +func (s *serviceGenerator) generateConfigProvider(f *protogen.GeneratedFile) { + t := f.QualifiedGoIdent(protogen.GoIdent{ + GoName: "T", + GoImportPath: "testing", + }) + name := serviceTestConfigSupplierName(s.service.Desc) + f.P("// ", name, " is the interface to implement to decide which resources") + f.P("// that should be tested and how it's configured.") + f.P("type ", name, " interface {") + for _, resource := range s.resources { + resourceFx := resourceTestSuiteConfigName(s.service.Desc, resource) + f.P("// ", resourceFx, " should return a config, or nil, which means that the tests will be skipped.") + f.P(resourceType(resource), "TestSuiteConfig(t *", t, ") *", resourceFx, "") + } + f.P("}") + f.P() +} + +func (s *serviceGenerator) generateMainTestFunction(f *protogen.GeneratedFile) { + t := f.QualifiedGoIdent(protogen.GoIdent{ + GoName: "T", + GoImportPath: "testing", + }) + funcName := "Test" + string(s.service.Desc.Name()) + f.P("// ", funcName, " is the main entrypoint for starting the AIP tests.") + f.P("func ", funcName, "(t *", t, ",s ", serviceTestConfigSupplierName(s.service.Desc), ") {") + for _, resource := range s.resources { + name := resourceTestSuiteConfigName(s.service.Desc, resource) + f.P("test", name, "(t, s)") + } + f.P("}") + f.P() +} + +func (s *serviceGenerator) generateTestFunctions(f *protogen.GeneratedFile) { + t := f.QualifiedGoIdent(protogen.GoIdent{ + GoName: "T", + GoImportPath: "testing", + }) + context := f.QualifiedGoIdent(protogen.GoIdent{ + GoName: "Context", + GoImportPath: "context", + }) + background := f.QualifiedGoIdent(protogen.GoIdent{ + GoName: "Background", + GoImportPath: "context", + }) + for _, resource := range s.resources { + name := resourceTestSuiteConfigName(s.service.Desc, resource) + f.P("func test", name, "(t *", t, ",s ", serviceTestConfigSupplierName(s.service.Desc), ") {") + f.P("t.Run(", strconv.Quote(resourceType(resource)), ", func(t *", t, ") {") + f.P("config := s.", resourceType(resource), "TestSuiteConfig(t)") + f.P("if (config == nil) {") + f.P("t.Skip(\"Method ", resourceType(resource), "TestSuiteConfig not implemented\")") + f.P("}") + f.P("if (config.Service == nil) {") + f.P("t.Skip(\"Method ", name, ".Service() not implemented\")") + f.P("}") + f.P("if (config.Context == nil) {") + f.P("config.Context = func() ", context, " { return ", background, "() }") + f.P("}") + f.P("config.test(t)") + f.P("})") + f.P("}") + f.P() + } +} + func (s *serviceGenerator) generateFixture(f *protogen.GeneratedFile) { testingT := f.QualifiedGoIdent(protogen.GoIdent{ GoName: "T", diff --git a/proto/gen/einride/example/freight/v1/freight_service_aiptest.pb.go b/proto/gen/einride/example/freight/v1/freight_service_aiptest.pb.go index c8d317e8..2decb41a 100644 --- a/proto/gen/einride/example/freight/v1/freight_service_aiptest.pb.go +++ b/proto/gen/einride/example/freight/v1/freight_service_aiptest.pb.go @@ -16,6 +16,53 @@ import ( time "time" ) +// FreightServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type FreightServiceTestSuiteConfigProvider interface { + // FreightServiceShipperTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ShipperTestSuiteConfig(t *testing.T) *FreightServiceShipperTestSuiteConfig + // FreightServiceSiteTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + SiteTestSuiteConfig(t *testing.T) *FreightServiceSiteTestSuiteConfig +} + +// TestFreightService is the main entrypoint for starting the AIP tests. +func TestFreightService(t *testing.T, s FreightServiceTestSuiteConfigProvider) { + testFreightServiceShipperTestSuiteConfig(t, s) + testFreightServiceSiteTestSuiteConfig(t, s) +} + +func testFreightServiceShipperTestSuiteConfig(t *testing.T, s FreightServiceTestSuiteConfigProvider) { + t.Run("Shipper", func(t *testing.T) { + config := s.ShipperTestSuiteConfig(t) + if config == nil { + t.Skip("Method ShipperTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FreightServiceShipperTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testFreightServiceSiteTestSuiteConfig(t *testing.T, s FreightServiceTestSuiteConfigProvider) { + t.Run("Site", func(t *testing.T) { + config := s.SiteTestSuiteConfig(t) + if config == nil { + t.Skip("Method SiteTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FreightServiceSiteTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type FreightServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/dataset_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/dataset_service_aiptest.pb.go index 871949e3..85bece4c 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/dataset_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/dataset_service_aiptest.pb.go @@ -15,6 +15,129 @@ import ( testing "testing" ) +// DatasetServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type DatasetServiceTestSuiteConfigProvider interface { + // DatasetServiceAnnotationTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + AnnotationTestSuiteConfig(t *testing.T) *DatasetServiceAnnotationTestSuiteConfig + // DatasetServiceAnnotationSpecTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + AnnotationSpecTestSuiteConfig(t *testing.T) *DatasetServiceAnnotationSpecTestSuiteConfig + // DatasetServiceDataItemTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DataItemTestSuiteConfig(t *testing.T) *DatasetServiceDataItemTestSuiteConfig + // DatasetServiceDatasetTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DatasetTestSuiteConfig(t *testing.T) *DatasetServiceDatasetTestSuiteConfig + // DatasetServiceDatasetVersionTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DatasetVersionTestSuiteConfig(t *testing.T) *DatasetServiceDatasetVersionTestSuiteConfig + // DatasetServiceSavedQueryTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + SavedQueryTestSuiteConfig(t *testing.T) *DatasetServiceSavedQueryTestSuiteConfig +} + +// TestDatasetService is the main entrypoint for starting the AIP tests. +func TestDatasetService(t *testing.T, s DatasetServiceTestSuiteConfigProvider) { + testDatasetServiceAnnotationTestSuiteConfig(t, s) + testDatasetServiceAnnotationSpecTestSuiteConfig(t, s) + testDatasetServiceDataItemTestSuiteConfig(t, s) + testDatasetServiceDatasetTestSuiteConfig(t, s) + testDatasetServiceDatasetVersionTestSuiteConfig(t, s) + testDatasetServiceSavedQueryTestSuiteConfig(t, s) +} + +func testDatasetServiceAnnotationTestSuiteConfig(t *testing.T, s DatasetServiceTestSuiteConfigProvider) { + t.Run("Annotation", func(t *testing.T) { + config := s.AnnotationTestSuiteConfig(t) + if config == nil { + t.Skip("Method AnnotationTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatasetServiceAnnotationTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testDatasetServiceAnnotationSpecTestSuiteConfig(t *testing.T, s DatasetServiceTestSuiteConfigProvider) { + t.Run("AnnotationSpec", func(t *testing.T) { + config := s.AnnotationSpecTestSuiteConfig(t) + if config == nil { + t.Skip("Method AnnotationSpecTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatasetServiceAnnotationSpecTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testDatasetServiceDataItemTestSuiteConfig(t *testing.T, s DatasetServiceTestSuiteConfigProvider) { + t.Run("DataItem", func(t *testing.T) { + config := s.DataItemTestSuiteConfig(t) + if config == nil { + t.Skip("Method DataItemTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatasetServiceDataItemTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testDatasetServiceDatasetTestSuiteConfig(t *testing.T, s DatasetServiceTestSuiteConfigProvider) { + t.Run("Dataset", func(t *testing.T) { + config := s.DatasetTestSuiteConfig(t) + if config == nil { + t.Skip("Method DatasetTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatasetServiceDatasetTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testDatasetServiceDatasetVersionTestSuiteConfig(t *testing.T, s DatasetServiceTestSuiteConfigProvider) { + t.Run("DatasetVersion", func(t *testing.T) { + config := s.DatasetVersionTestSuiteConfig(t) + if config == nil { + t.Skip("Method DatasetVersionTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatasetServiceDatasetVersionTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testDatasetServiceSavedQueryTestSuiteConfig(t *testing.T, s DatasetServiceTestSuiteConfigProvider) { + t.Run("SavedQuery", func(t *testing.T) { + config := s.SavedQueryTestSuiteConfig(t) + if config == nil { + t.Skip("Method SavedQueryTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatasetServiceSavedQueryTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type DatasetServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/deployment_resource_pool_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/deployment_resource_pool_service_aiptest.pb.go index 27101479..e9a3457b 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/deployment_resource_pool_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/deployment_resource_pool_service_aiptest.pb.go @@ -13,6 +13,34 @@ import ( testing "testing" ) +// DeploymentResourcePoolServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type DeploymentResourcePoolServiceTestSuiteConfigProvider interface { + // DeploymentResourcePoolServiceDeploymentResourcePoolTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DeploymentResourcePoolTestSuiteConfig(t *testing.T) *DeploymentResourcePoolServiceDeploymentResourcePoolTestSuiteConfig +} + +// TestDeploymentResourcePoolService is the main entrypoint for starting the AIP tests. +func TestDeploymentResourcePoolService(t *testing.T, s DeploymentResourcePoolServiceTestSuiteConfigProvider) { + testDeploymentResourcePoolServiceDeploymentResourcePoolTestSuiteConfig(t, s) +} + +func testDeploymentResourcePoolServiceDeploymentResourcePoolTestSuiteConfig(t *testing.T, s DeploymentResourcePoolServiceTestSuiteConfigProvider) { + t.Run("DeploymentResourcePool", func(t *testing.T) { + config := s.DeploymentResourcePoolTestSuiteConfig(t) + if config == nil { + t.Skip("Method DeploymentResourcePoolTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DeploymentResourcePoolServiceDeploymentResourcePoolTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type DeploymentResourcePoolServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/endpoint_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/endpoint_service_aiptest.pb.go index 6afc1ccb..531fe6a1 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/endpoint_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/endpoint_service_aiptest.pb.go @@ -15,6 +15,34 @@ import ( testing "testing" ) +// EndpointServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type EndpointServiceTestSuiteConfigProvider interface { + // EndpointServiceEndpointTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + EndpointTestSuiteConfig(t *testing.T) *EndpointServiceEndpointTestSuiteConfig +} + +// TestEndpointService is the main entrypoint for starting the AIP tests. +func TestEndpointService(t *testing.T, s EndpointServiceTestSuiteConfigProvider) { + testEndpointServiceEndpointTestSuiteConfig(t, s) +} + +func testEndpointServiceEndpointTestSuiteConfig(t *testing.T, s EndpointServiceTestSuiteConfigProvider) { + t.Run("Endpoint", func(t *testing.T) { + config := s.EndpointTestSuiteConfig(t) + if config == nil { + t.Skip("Method EndpointTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method EndpointServiceEndpointTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type EndpointServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_online_store_admin_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_online_store_admin_service_aiptest.pb.go index cc01d3d9..7bdbf49b 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_online_store_admin_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_online_store_admin_service_aiptest.pb.go @@ -15,6 +15,72 @@ import ( testing "testing" ) +// FeatureOnlineStoreAdminServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type FeatureOnlineStoreAdminServiceTestSuiteConfigProvider interface { + // FeatureOnlineStoreAdminServiceFeatureOnlineStoreTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + FeatureOnlineStoreTestSuiteConfig(t *testing.T) *FeatureOnlineStoreAdminServiceFeatureOnlineStoreTestSuiteConfig + // FeatureOnlineStoreAdminServiceFeatureViewTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + FeatureViewTestSuiteConfig(t *testing.T) *FeatureOnlineStoreAdminServiceFeatureViewTestSuiteConfig + // FeatureOnlineStoreAdminServiceFeatureViewSyncTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + FeatureViewSyncTestSuiteConfig(t *testing.T) *FeatureOnlineStoreAdminServiceFeatureViewSyncTestSuiteConfig +} + +// TestFeatureOnlineStoreAdminService is the main entrypoint for starting the AIP tests. +func TestFeatureOnlineStoreAdminService(t *testing.T, s FeatureOnlineStoreAdminServiceTestSuiteConfigProvider) { + testFeatureOnlineStoreAdminServiceFeatureOnlineStoreTestSuiteConfig(t, s) + testFeatureOnlineStoreAdminServiceFeatureViewTestSuiteConfig(t, s) + testFeatureOnlineStoreAdminServiceFeatureViewSyncTestSuiteConfig(t, s) +} + +func testFeatureOnlineStoreAdminServiceFeatureOnlineStoreTestSuiteConfig(t *testing.T, s FeatureOnlineStoreAdminServiceTestSuiteConfigProvider) { + t.Run("FeatureOnlineStore", func(t *testing.T) { + config := s.FeatureOnlineStoreTestSuiteConfig(t) + if config == nil { + t.Skip("Method FeatureOnlineStoreTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeatureOnlineStoreAdminServiceFeatureOnlineStoreTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testFeatureOnlineStoreAdminServiceFeatureViewTestSuiteConfig(t *testing.T, s FeatureOnlineStoreAdminServiceTestSuiteConfigProvider) { + t.Run("FeatureView", func(t *testing.T) { + config := s.FeatureViewTestSuiteConfig(t) + if config == nil { + t.Skip("Method FeatureViewTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeatureOnlineStoreAdminServiceFeatureViewTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testFeatureOnlineStoreAdminServiceFeatureViewSyncTestSuiteConfig(t *testing.T, s FeatureOnlineStoreAdminServiceTestSuiteConfigProvider) { + t.Run("FeatureViewSync", func(t *testing.T) { + config := s.FeatureViewSyncTestSuiteConfig(t) + if config == nil { + t.Skip("Method FeatureViewSyncTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeatureOnlineStoreAdminServiceFeatureViewSyncTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type FeatureOnlineStoreAdminServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_registry_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_registry_service_aiptest.pb.go index b48503c0..709df196 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_registry_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/feature_registry_service_aiptest.pb.go @@ -15,6 +15,53 @@ import ( testing "testing" ) +// FeatureRegistryServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type FeatureRegistryServiceTestSuiteConfigProvider interface { + // FeatureRegistryServiceFeatureTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + FeatureTestSuiteConfig(t *testing.T) *FeatureRegistryServiceFeatureTestSuiteConfig + // FeatureRegistryServiceFeatureGroupTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + FeatureGroupTestSuiteConfig(t *testing.T) *FeatureRegistryServiceFeatureGroupTestSuiteConfig +} + +// TestFeatureRegistryService is the main entrypoint for starting the AIP tests. +func TestFeatureRegistryService(t *testing.T, s FeatureRegistryServiceTestSuiteConfigProvider) { + testFeatureRegistryServiceFeatureTestSuiteConfig(t, s) + testFeatureRegistryServiceFeatureGroupTestSuiteConfig(t, s) +} + +func testFeatureRegistryServiceFeatureTestSuiteConfig(t *testing.T, s FeatureRegistryServiceTestSuiteConfigProvider) { + t.Run("Feature", func(t *testing.T) { + config := s.FeatureTestSuiteConfig(t) + if config == nil { + t.Skip("Method FeatureTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeatureRegistryServiceFeatureTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testFeatureRegistryServiceFeatureGroupTestSuiteConfig(t *testing.T, s FeatureRegistryServiceTestSuiteConfigProvider) { + t.Run("FeatureGroup", func(t *testing.T) { + config := s.FeatureGroupTestSuiteConfig(t) + if config == nil { + t.Skip("Method FeatureGroupTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeatureRegistryServiceFeatureGroupTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type FeatureRegistryServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/featurestore_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/featurestore_service_aiptest.pb.go index d7b49fac..0edd6e72 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/featurestore_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/featurestore_service_aiptest.pb.go @@ -15,6 +15,72 @@ import ( testing "testing" ) +// FeaturestoreServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type FeaturestoreServiceTestSuiteConfigProvider interface { + // FeaturestoreServiceEntityTypeTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + EntityTypeTestSuiteConfig(t *testing.T) *FeaturestoreServiceEntityTypeTestSuiteConfig + // FeaturestoreServiceFeatureTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + FeatureTestSuiteConfig(t *testing.T) *FeaturestoreServiceFeatureTestSuiteConfig + // FeaturestoreServiceFeaturestoreTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + FeaturestoreTestSuiteConfig(t *testing.T) *FeaturestoreServiceFeaturestoreTestSuiteConfig +} + +// TestFeaturestoreService is the main entrypoint for starting the AIP tests. +func TestFeaturestoreService(t *testing.T, s FeaturestoreServiceTestSuiteConfigProvider) { + testFeaturestoreServiceEntityTypeTestSuiteConfig(t, s) + testFeaturestoreServiceFeatureTestSuiteConfig(t, s) + testFeaturestoreServiceFeaturestoreTestSuiteConfig(t, s) +} + +func testFeaturestoreServiceEntityTypeTestSuiteConfig(t *testing.T, s FeaturestoreServiceTestSuiteConfigProvider) { + t.Run("EntityType", func(t *testing.T) { + config := s.EntityTypeTestSuiteConfig(t) + if config == nil { + t.Skip("Method EntityTypeTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeaturestoreServiceEntityTypeTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testFeaturestoreServiceFeatureTestSuiteConfig(t *testing.T, s FeaturestoreServiceTestSuiteConfigProvider) { + t.Run("Feature", func(t *testing.T) { + config := s.FeatureTestSuiteConfig(t) + if config == nil { + t.Skip("Method FeatureTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeaturestoreServiceFeatureTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testFeaturestoreServiceFeaturestoreTestSuiteConfig(t *testing.T, s FeaturestoreServiceTestSuiteConfigProvider) { + t.Run("Featurestore", func(t *testing.T) { + config := s.FeaturestoreTestSuiteConfig(t) + if config == nil { + t.Skip("Method FeaturestoreTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method FeaturestoreServiceFeaturestoreTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type FeaturestoreServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_endpoint_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_endpoint_service_aiptest.pb.go index 0c1aec1d..7747d66f 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_endpoint_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_endpoint_service_aiptest.pb.go @@ -15,6 +15,34 @@ import ( testing "testing" ) +// IndexEndpointServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type IndexEndpointServiceTestSuiteConfigProvider interface { + // IndexEndpointServiceIndexEndpointTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + IndexEndpointTestSuiteConfig(t *testing.T) *IndexEndpointServiceIndexEndpointTestSuiteConfig +} + +// TestIndexEndpointService is the main entrypoint for starting the AIP tests. +func TestIndexEndpointService(t *testing.T, s IndexEndpointServiceTestSuiteConfigProvider) { + testIndexEndpointServiceIndexEndpointTestSuiteConfig(t, s) +} + +func testIndexEndpointServiceIndexEndpointTestSuiteConfig(t *testing.T, s IndexEndpointServiceTestSuiteConfigProvider) { + t.Run("IndexEndpoint", func(t *testing.T) { + config := s.IndexEndpointTestSuiteConfig(t) + if config == nil { + t.Skip("Method IndexEndpointTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method IndexEndpointServiceIndexEndpointTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type IndexEndpointServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_service_aiptest.pb.go index d16ad798..06b78e6d 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/index_service_aiptest.pb.go @@ -15,6 +15,34 @@ import ( testing "testing" ) +// IndexServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type IndexServiceTestSuiteConfigProvider interface { + // IndexServiceIndexTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + IndexTestSuiteConfig(t *testing.T) *IndexServiceIndexTestSuiteConfig +} + +// TestIndexService is the main entrypoint for starting the AIP tests. +func TestIndexService(t *testing.T, s IndexServiceTestSuiteConfigProvider) { + testIndexServiceIndexTestSuiteConfig(t, s) +} + +func testIndexServiceIndexTestSuiteConfig(t *testing.T, s IndexServiceTestSuiteConfigProvider) { + t.Run("Index", func(t *testing.T) { + config := s.IndexTestSuiteConfig(t) + if config == nil { + t.Skip("Method IndexTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method IndexServiceIndexTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type IndexServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/job_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/job_service_aiptest.pb.go index e149a154..073311a3 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/job_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/job_service_aiptest.pb.go @@ -16,6 +16,148 @@ import ( time "time" ) +// JobServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type JobServiceTestSuiteConfigProvider interface { + // JobServiceBatchPredictionJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + BatchPredictionJobTestSuiteConfig(t *testing.T) *JobServiceBatchPredictionJobTestSuiteConfig + // JobServiceCustomJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + CustomJobTestSuiteConfig(t *testing.T) *JobServiceCustomJobTestSuiteConfig + // JobServiceDataLabelingJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DataLabelingJobTestSuiteConfig(t *testing.T) *JobServiceDataLabelingJobTestSuiteConfig + // JobServiceHyperparameterTuningJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + HyperparameterTuningJobTestSuiteConfig(t *testing.T) *JobServiceHyperparameterTuningJobTestSuiteConfig + // JobServiceModelDeploymentMonitoringJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ModelDeploymentMonitoringJobTestSuiteConfig(t *testing.T) *JobServiceModelDeploymentMonitoringJobTestSuiteConfig + // JobServiceNasJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + NasJobTestSuiteConfig(t *testing.T) *JobServiceNasJobTestSuiteConfig + // JobServiceNasTrialDetailTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + NasTrialDetailTestSuiteConfig(t *testing.T) *JobServiceNasTrialDetailTestSuiteConfig +} + +// TestJobService is the main entrypoint for starting the AIP tests. +func TestJobService(t *testing.T, s JobServiceTestSuiteConfigProvider) { + testJobServiceBatchPredictionJobTestSuiteConfig(t, s) + testJobServiceCustomJobTestSuiteConfig(t, s) + testJobServiceDataLabelingJobTestSuiteConfig(t, s) + testJobServiceHyperparameterTuningJobTestSuiteConfig(t, s) + testJobServiceModelDeploymentMonitoringJobTestSuiteConfig(t, s) + testJobServiceNasJobTestSuiteConfig(t, s) + testJobServiceNasTrialDetailTestSuiteConfig(t, s) +} + +func testJobServiceBatchPredictionJobTestSuiteConfig(t *testing.T, s JobServiceTestSuiteConfigProvider) { + t.Run("BatchPredictionJob", func(t *testing.T) { + config := s.BatchPredictionJobTestSuiteConfig(t) + if config == nil { + t.Skip("Method BatchPredictionJobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method JobServiceBatchPredictionJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testJobServiceCustomJobTestSuiteConfig(t *testing.T, s JobServiceTestSuiteConfigProvider) { + t.Run("CustomJob", func(t *testing.T) { + config := s.CustomJobTestSuiteConfig(t) + if config == nil { + t.Skip("Method CustomJobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method JobServiceCustomJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testJobServiceDataLabelingJobTestSuiteConfig(t *testing.T, s JobServiceTestSuiteConfigProvider) { + t.Run("DataLabelingJob", func(t *testing.T) { + config := s.DataLabelingJobTestSuiteConfig(t) + if config == nil { + t.Skip("Method DataLabelingJobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method JobServiceDataLabelingJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testJobServiceHyperparameterTuningJobTestSuiteConfig(t *testing.T, s JobServiceTestSuiteConfigProvider) { + t.Run("HyperparameterTuningJob", func(t *testing.T) { + config := s.HyperparameterTuningJobTestSuiteConfig(t) + if config == nil { + t.Skip("Method HyperparameterTuningJobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method JobServiceHyperparameterTuningJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testJobServiceModelDeploymentMonitoringJobTestSuiteConfig(t *testing.T, s JobServiceTestSuiteConfigProvider) { + t.Run("ModelDeploymentMonitoringJob", func(t *testing.T) { + config := s.ModelDeploymentMonitoringJobTestSuiteConfig(t) + if config == nil { + t.Skip("Method ModelDeploymentMonitoringJobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method JobServiceModelDeploymentMonitoringJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testJobServiceNasJobTestSuiteConfig(t *testing.T, s JobServiceTestSuiteConfigProvider) { + t.Run("NasJob", func(t *testing.T) { + config := s.NasJobTestSuiteConfig(t) + if config == nil { + t.Skip("Method NasJobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method JobServiceNasJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testJobServiceNasTrialDetailTestSuiteConfig(t *testing.T, s JobServiceTestSuiteConfigProvider) { + t.Run("NasTrialDetail", func(t *testing.T) { + config := s.NasTrialDetailTestSuiteConfig(t) + if config == nil { + t.Skip("Method NasTrialDetailTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method JobServiceNasTrialDetailTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type JobServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/metadata_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/metadata_service_aiptest.pb.go index d5c4562f..1e3cdae6 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/metadata_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/metadata_service_aiptest.pb.go @@ -15,6 +15,110 @@ import ( time "time" ) +// MetadataServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type MetadataServiceTestSuiteConfigProvider interface { + // MetadataServiceArtifactTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ArtifactTestSuiteConfig(t *testing.T) *MetadataServiceArtifactTestSuiteConfig + // MetadataServiceContextTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ContextTestSuiteConfig(t *testing.T) *MetadataServiceContextTestSuiteConfig + // MetadataServiceExecutionTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ExecutionTestSuiteConfig(t *testing.T) *MetadataServiceExecutionTestSuiteConfig + // MetadataServiceMetadataSchemaTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + MetadataSchemaTestSuiteConfig(t *testing.T) *MetadataServiceMetadataSchemaTestSuiteConfig + // MetadataServiceMetadataStoreTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + MetadataStoreTestSuiteConfig(t *testing.T) *MetadataServiceMetadataStoreTestSuiteConfig +} + +// TestMetadataService is the main entrypoint for starting the AIP tests. +func TestMetadataService(t *testing.T, s MetadataServiceTestSuiteConfigProvider) { + testMetadataServiceArtifactTestSuiteConfig(t, s) + testMetadataServiceContextTestSuiteConfig(t, s) + testMetadataServiceExecutionTestSuiteConfig(t, s) + testMetadataServiceMetadataSchemaTestSuiteConfig(t, s) + testMetadataServiceMetadataStoreTestSuiteConfig(t, s) +} + +func testMetadataServiceArtifactTestSuiteConfig(t *testing.T, s MetadataServiceTestSuiteConfigProvider) { + t.Run("Artifact", func(t *testing.T) { + config := s.ArtifactTestSuiteConfig(t) + if config == nil { + t.Skip("Method ArtifactTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method MetadataServiceArtifactTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testMetadataServiceContextTestSuiteConfig(t *testing.T, s MetadataServiceTestSuiteConfigProvider) { + t.Run("Context", func(t *testing.T) { + config := s.ContextTestSuiteConfig(t) + if config == nil { + t.Skip("Method ContextTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method MetadataServiceContextTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testMetadataServiceExecutionTestSuiteConfig(t *testing.T, s MetadataServiceTestSuiteConfigProvider) { + t.Run("Execution", func(t *testing.T) { + config := s.ExecutionTestSuiteConfig(t) + if config == nil { + t.Skip("Method ExecutionTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method MetadataServiceExecutionTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testMetadataServiceMetadataSchemaTestSuiteConfig(t *testing.T, s MetadataServiceTestSuiteConfigProvider) { + t.Run("MetadataSchema", func(t *testing.T) { + config := s.MetadataSchemaTestSuiteConfig(t) + if config == nil { + t.Skip("Method MetadataSchemaTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method MetadataServiceMetadataSchemaTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testMetadataServiceMetadataStoreTestSuiteConfig(t *testing.T, s MetadataServiceTestSuiteConfigProvider) { + t.Run("MetadataStore", func(t *testing.T) { + config := s.MetadataStoreTestSuiteConfig(t) + if config == nil { + t.Skip("Method MetadataStoreTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method MetadataServiceMetadataStoreTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type MetadataServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_garden_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_garden_service_aiptest.pb.go index f5ffe723..72a4ebcb 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_garden_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_garden_service_aiptest.pb.go @@ -12,6 +12,34 @@ import ( testing "testing" ) +// ModelGardenServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type ModelGardenServiceTestSuiteConfigProvider interface { + // ModelGardenServicePublisherModelTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + PublisherModelTestSuiteConfig(t *testing.T) *ModelGardenServicePublisherModelTestSuiteConfig +} + +// TestModelGardenService is the main entrypoint for starting the AIP tests. +func TestModelGardenService(t *testing.T, s ModelGardenServiceTestSuiteConfigProvider) { + testModelGardenServicePublisherModelTestSuiteConfig(t, s) +} + +func testModelGardenServicePublisherModelTestSuiteConfig(t *testing.T, s ModelGardenServiceTestSuiteConfigProvider) { + t.Run("PublisherModel", func(t *testing.T) { + config := s.PublisherModelTestSuiteConfig(t) + if config == nil { + t.Skip("Method PublisherModelTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method ModelGardenServicePublisherModelTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type ModelGardenServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_service_aiptest.pb.go index 40bf7515..271dda51 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/model_service_aiptest.pb.go @@ -15,6 +15,72 @@ import ( testing "testing" ) +// ModelServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type ModelServiceTestSuiteConfigProvider interface { + // ModelServiceModelTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ModelTestSuiteConfig(t *testing.T) *ModelServiceModelTestSuiteConfig + // ModelServiceModelEvaluationTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ModelEvaluationTestSuiteConfig(t *testing.T) *ModelServiceModelEvaluationTestSuiteConfig + // ModelServiceModelEvaluationSliceTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ModelEvaluationSliceTestSuiteConfig(t *testing.T) *ModelServiceModelEvaluationSliceTestSuiteConfig +} + +// TestModelService is the main entrypoint for starting the AIP tests. +func TestModelService(t *testing.T, s ModelServiceTestSuiteConfigProvider) { + testModelServiceModelTestSuiteConfig(t, s) + testModelServiceModelEvaluationTestSuiteConfig(t, s) + testModelServiceModelEvaluationSliceTestSuiteConfig(t, s) +} + +func testModelServiceModelTestSuiteConfig(t *testing.T, s ModelServiceTestSuiteConfigProvider) { + t.Run("Model", func(t *testing.T) { + config := s.ModelTestSuiteConfig(t) + if config == nil { + t.Skip("Method ModelTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method ModelServiceModelTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testModelServiceModelEvaluationTestSuiteConfig(t *testing.T, s ModelServiceTestSuiteConfigProvider) { + t.Run("ModelEvaluation", func(t *testing.T) { + config := s.ModelEvaluationTestSuiteConfig(t) + if config == nil { + t.Skip("Method ModelEvaluationTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method ModelServiceModelEvaluationTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testModelServiceModelEvaluationSliceTestSuiteConfig(t *testing.T, s ModelServiceTestSuiteConfigProvider) { + t.Run("ModelEvaluationSlice", func(t *testing.T) { + config := s.ModelEvaluationSliceTestSuiteConfig(t) + if config == nil { + t.Skip("Method ModelEvaluationSliceTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method ModelServiceModelEvaluationSliceTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type ModelServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/pipeline_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/pipeline_service_aiptest.pb.go index a8188c84..3ebb33ac 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/pipeline_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/pipeline_service_aiptest.pb.go @@ -14,6 +14,53 @@ import ( time "time" ) +// PipelineServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type PipelineServiceTestSuiteConfigProvider interface { + // PipelineServicePipelineJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + PipelineJobTestSuiteConfig(t *testing.T) *PipelineServicePipelineJobTestSuiteConfig + // PipelineServiceTrainingPipelineTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TrainingPipelineTestSuiteConfig(t *testing.T) *PipelineServiceTrainingPipelineTestSuiteConfig +} + +// TestPipelineService is the main entrypoint for starting the AIP tests. +func TestPipelineService(t *testing.T, s PipelineServiceTestSuiteConfigProvider) { + testPipelineServicePipelineJobTestSuiteConfig(t, s) + testPipelineServiceTrainingPipelineTestSuiteConfig(t, s) +} + +func testPipelineServicePipelineJobTestSuiteConfig(t *testing.T, s PipelineServiceTestSuiteConfigProvider) { + t.Run("PipelineJob", func(t *testing.T) { + config := s.PipelineJobTestSuiteConfig(t) + if config == nil { + t.Skip("Method PipelineJobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method PipelineServicePipelineJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testPipelineServiceTrainingPipelineTestSuiteConfig(t *testing.T, s PipelineServiceTestSuiteConfigProvider) { + t.Run("TrainingPipeline", func(t *testing.T) { + config := s.TrainingPipelineTestSuiteConfig(t) + if config == nil { + t.Skip("Method TrainingPipelineTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method PipelineServiceTrainingPipelineTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type PipelineServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/schedule_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/schedule_service_aiptest.pb.go index 4eba5340..2501d94e 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/schedule_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/schedule_service_aiptest.pb.go @@ -16,6 +16,34 @@ import ( time "time" ) +// ScheduleServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type ScheduleServiceTestSuiteConfigProvider interface { + // ScheduleServiceScheduleTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + ScheduleTestSuiteConfig(t *testing.T) *ScheduleServiceScheduleTestSuiteConfig +} + +// TestScheduleService is the main entrypoint for starting the AIP tests. +func TestScheduleService(t *testing.T, s ScheduleServiceTestSuiteConfigProvider) { + testScheduleServiceScheduleTestSuiteConfig(t, s) +} + +func testScheduleServiceScheduleTestSuiteConfig(t *testing.T, s ScheduleServiceTestSuiteConfigProvider) { + t.Run("Schedule", func(t *testing.T) { + config := s.ScheduleTestSuiteConfig(t) + if config == nil { + t.Skip("Method ScheduleTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method ScheduleServiceScheduleTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type ScheduleServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/specialist_pool_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/specialist_pool_service_aiptest.pb.go index 455e6a10..6f811dd0 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/specialist_pool_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/specialist_pool_service_aiptest.pb.go @@ -15,6 +15,34 @@ import ( testing "testing" ) +// SpecialistPoolServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type SpecialistPoolServiceTestSuiteConfigProvider interface { + // SpecialistPoolServiceSpecialistPoolTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + SpecialistPoolTestSuiteConfig(t *testing.T) *SpecialistPoolServiceSpecialistPoolTestSuiteConfig +} + +// TestSpecialistPoolService is the main entrypoint for starting the AIP tests. +func TestSpecialistPoolService(t *testing.T, s SpecialistPoolServiceTestSuiteConfigProvider) { + testSpecialistPoolServiceSpecialistPoolTestSuiteConfig(t, s) +} + +func testSpecialistPoolServiceSpecialistPoolTestSuiteConfig(t *testing.T, s SpecialistPoolServiceTestSuiteConfigProvider) { + t.Run("SpecialistPool", func(t *testing.T) { + config := s.SpecialistPoolTestSuiteConfig(t) + if config == nil { + t.Skip("Method SpecialistPoolTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method SpecialistPoolServiceSpecialistPoolTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type SpecialistPoolServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/tensorboard_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/tensorboard_service_aiptest.pb.go index 316db2e0..c281f4ab 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/tensorboard_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/tensorboard_service_aiptest.pb.go @@ -16,6 +16,91 @@ import ( time "time" ) +// TensorboardServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type TensorboardServiceTestSuiteConfigProvider interface { + // TensorboardServiceTensorboardTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TensorboardTestSuiteConfig(t *testing.T) *TensorboardServiceTensorboardTestSuiteConfig + // TensorboardServiceTensorboardExperimentTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TensorboardExperimentTestSuiteConfig(t *testing.T) *TensorboardServiceTensorboardExperimentTestSuiteConfig + // TensorboardServiceTensorboardRunTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TensorboardRunTestSuiteConfig(t *testing.T) *TensorboardServiceTensorboardRunTestSuiteConfig + // TensorboardServiceTensorboardTimeSeriesTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TensorboardTimeSeriesTestSuiteConfig(t *testing.T) *TensorboardServiceTensorboardTimeSeriesTestSuiteConfig +} + +// TestTensorboardService is the main entrypoint for starting the AIP tests. +func TestTensorboardService(t *testing.T, s TensorboardServiceTestSuiteConfigProvider) { + testTensorboardServiceTensorboardTestSuiteConfig(t, s) + testTensorboardServiceTensorboardExperimentTestSuiteConfig(t, s) + testTensorboardServiceTensorboardRunTestSuiteConfig(t, s) + testTensorboardServiceTensorboardTimeSeriesTestSuiteConfig(t, s) +} + +func testTensorboardServiceTensorboardTestSuiteConfig(t *testing.T, s TensorboardServiceTestSuiteConfigProvider) { + t.Run("Tensorboard", func(t *testing.T) { + config := s.TensorboardTestSuiteConfig(t) + if config == nil { + t.Skip("Method TensorboardTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method TensorboardServiceTensorboardTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testTensorboardServiceTensorboardExperimentTestSuiteConfig(t *testing.T, s TensorboardServiceTestSuiteConfigProvider) { + t.Run("TensorboardExperiment", func(t *testing.T) { + config := s.TensorboardExperimentTestSuiteConfig(t) + if config == nil { + t.Skip("Method TensorboardExperimentTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method TensorboardServiceTensorboardExperimentTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testTensorboardServiceTensorboardRunTestSuiteConfig(t *testing.T, s TensorboardServiceTestSuiteConfigProvider) { + t.Run("TensorboardRun", func(t *testing.T) { + config := s.TensorboardRunTestSuiteConfig(t) + if config == nil { + t.Skip("Method TensorboardRunTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method TensorboardServiceTensorboardRunTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testTensorboardServiceTensorboardTimeSeriesTestSuiteConfig(t *testing.T, s TensorboardServiceTestSuiteConfigProvider) { + t.Run("TensorboardTimeSeries", func(t *testing.T) { + config := s.TensorboardTimeSeriesTestSuiteConfig(t) + if config == nil { + t.Skip("Method TensorboardTimeSeriesTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method TensorboardServiceTensorboardTimeSeriesTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type TensorboardServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/vizier_service_aiptest.pb.go b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/vizier_service_aiptest.pb.go index a757aeaf..a5004ed2 100644 --- a/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/vizier_service_aiptest.pb.go +++ b/proto/gen/googleapis/aiplatform/apiv1/aiplatformpb/vizier_service_aiptest.pb.go @@ -14,6 +14,53 @@ import ( time "time" ) +// VizierServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type VizierServiceTestSuiteConfigProvider interface { + // VizierServiceStudyTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + StudyTestSuiteConfig(t *testing.T) *VizierServiceStudyTestSuiteConfig + // VizierServiceTrialTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TrialTestSuiteConfig(t *testing.T) *VizierServiceTrialTestSuiteConfig +} + +// TestVizierService is the main entrypoint for starting the AIP tests. +func TestVizierService(t *testing.T, s VizierServiceTestSuiteConfigProvider) { + testVizierServiceStudyTestSuiteConfig(t, s) + testVizierServiceTrialTestSuiteConfig(t, s) +} + +func testVizierServiceStudyTestSuiteConfig(t *testing.T, s VizierServiceTestSuiteConfigProvider) { + t.Run("Study", func(t *testing.T) { + config := s.StudyTestSuiteConfig(t) + if config == nil { + t.Skip("Method StudyTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method VizierServiceStudyTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testVizierServiceTrialTestSuiteConfig(t *testing.T, s VizierServiceTestSuiteConfigProvider) { + t.Run("Trial", func(t *testing.T) { + config := s.TrialTestSuiteConfig(t) + if config == nil { + t.Skip("Method TrialTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method VizierServiceTrialTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type VizierServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/area120/tables/apiv1alpha1/tablespb/tables_aiptest.pb.go b/proto/gen/googleapis/area120/tables/apiv1alpha1/tablespb/tables_aiptest.pb.go index 01bd7033..db88386a 100644 --- a/proto/gen/googleapis/area120/tables/apiv1alpha1/tablespb/tables_aiptest.pb.go +++ b/proto/gen/googleapis/area120/tables/apiv1alpha1/tablespb/tables_aiptest.pb.go @@ -14,6 +14,72 @@ import ( testing "testing" ) +// TablesServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type TablesServiceTestSuiteConfigProvider interface { + // TablesServiceRowTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + RowTestSuiteConfig(t *testing.T) *TablesServiceRowTestSuiteConfig + // TablesServiceTableTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TableTestSuiteConfig(t *testing.T) *TablesServiceTableTestSuiteConfig + // TablesServiceWorkspaceTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + WorkspaceTestSuiteConfig(t *testing.T) *TablesServiceWorkspaceTestSuiteConfig +} + +// TestTablesService is the main entrypoint for starting the AIP tests. +func TestTablesService(t *testing.T, s TablesServiceTestSuiteConfigProvider) { + testTablesServiceRowTestSuiteConfig(t, s) + testTablesServiceTableTestSuiteConfig(t, s) + testTablesServiceWorkspaceTestSuiteConfig(t, s) +} + +func testTablesServiceRowTestSuiteConfig(t *testing.T, s TablesServiceTestSuiteConfigProvider) { + t.Run("Row", func(t *testing.T) { + config := s.RowTestSuiteConfig(t) + if config == nil { + t.Skip("Method RowTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method TablesServiceRowTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testTablesServiceTableTestSuiteConfig(t *testing.T, s TablesServiceTestSuiteConfigProvider) { + t.Run("Table", func(t *testing.T) { + config := s.TableTestSuiteConfig(t) + if config == nil { + t.Skip("Method TableTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method TablesServiceTableTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testTablesServiceWorkspaceTestSuiteConfig(t *testing.T, s TablesServiceTestSuiteConfigProvider) { + t.Run("Workspace", func(t *testing.T) { + config := s.WorkspaceTestSuiteConfig(t) + if config == nil { + t.Skip("Method WorkspaceTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method TablesServiceWorkspaceTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type TablesServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/gsuiteaddons/apiv1/gsuiteaddonspb/gsuiteaddons_aiptest.pb.go b/proto/gen/googleapis/gsuiteaddons/apiv1/gsuiteaddonspb/gsuiteaddons_aiptest.pb.go index fe9ec721..890f9b99 100644 --- a/proto/gen/googleapis/gsuiteaddons/apiv1/gsuiteaddonspb/gsuiteaddons_aiptest.pb.go +++ b/proto/gen/googleapis/gsuiteaddons/apiv1/gsuiteaddonspb/gsuiteaddons_aiptest.pb.go @@ -13,6 +13,72 @@ import ( testing "testing" ) +// GSuiteAddOnsTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type GSuiteAddOnsTestSuiteConfigProvider interface { + // GSuiteAddOnsAuthorizationTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + AuthorizationTestSuiteConfig(t *testing.T) *GSuiteAddOnsAuthorizationTestSuiteConfig + // GSuiteAddOnsDeploymentTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DeploymentTestSuiteConfig(t *testing.T) *GSuiteAddOnsDeploymentTestSuiteConfig + // GSuiteAddOnsInstallStatusTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + InstallStatusTestSuiteConfig(t *testing.T) *GSuiteAddOnsInstallStatusTestSuiteConfig +} + +// TestGSuiteAddOns is the main entrypoint for starting the AIP tests. +func TestGSuiteAddOns(t *testing.T, s GSuiteAddOnsTestSuiteConfigProvider) { + testGSuiteAddOnsAuthorizationTestSuiteConfig(t, s) + testGSuiteAddOnsDeploymentTestSuiteConfig(t, s) + testGSuiteAddOnsInstallStatusTestSuiteConfig(t, s) +} + +func testGSuiteAddOnsAuthorizationTestSuiteConfig(t *testing.T, s GSuiteAddOnsTestSuiteConfigProvider) { + t.Run("Authorization", func(t *testing.T) { + config := s.AuthorizationTestSuiteConfig(t) + if config == nil { + t.Skip("Method AuthorizationTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method GSuiteAddOnsAuthorizationTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testGSuiteAddOnsDeploymentTestSuiteConfig(t *testing.T, s GSuiteAddOnsTestSuiteConfigProvider) { + t.Run("Deployment", func(t *testing.T) { + config := s.DeploymentTestSuiteConfig(t) + if config == nil { + t.Skip("Method DeploymentTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method GSuiteAddOnsDeploymentTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testGSuiteAddOnsInstallStatusTestSuiteConfig(t *testing.T, s GSuiteAddOnsTestSuiteConfigProvider) { + t.Run("InstallStatus", func(t *testing.T) { + config := s.InstallStatusTestSuiteConfig(t) + if config == nil { + t.Skip("Method InstallStatusTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method GSuiteAddOnsInstallStatusTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type GSuiteAddOnsTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/pubsub/apiv1/pubsubpb/pubsub_aiptest.pb.go b/proto/gen/googleapis/pubsub/apiv1/pubsubpb/pubsub_aiptest.pb.go index c441c8da..73daabd5 100644 --- a/proto/gen/googleapis/pubsub/apiv1/pubsubpb/pubsub_aiptest.pb.go +++ b/proto/gen/googleapis/pubsub/apiv1/pubsubpb/pubsub_aiptest.pb.go @@ -13,6 +13,34 @@ import ( testing "testing" ) +// PublisherTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type PublisherTestSuiteConfigProvider interface { + // PublisherTopicTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + TopicTestSuiteConfig(t *testing.T) *PublisherTopicTestSuiteConfig +} + +// TestPublisher is the main entrypoint for starting the AIP tests. +func TestPublisher(t *testing.T, s PublisherTestSuiteConfigProvider) { + testPublisherTopicTestSuiteConfig(t, s) +} + +func testPublisherTopicTestSuiteConfig(t *testing.T, s PublisherTestSuiteConfigProvider) { + t.Run("Topic", func(t *testing.T) { + config := s.TopicTestSuiteConfig(t) + if config == nil { + t.Skip("Method TopicTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method PublisherTopicTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type PublisherTestSuite struct { T *testing.T // Server to test. @@ -272,6 +300,53 @@ func (fx *PublisherTopicTestSuiteConfig) create(t *testing.T, parent string) *To return created } +// SubscriberTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type SubscriberTestSuiteConfigProvider interface { + // SubscriberSnapshotTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + SnapshotTestSuiteConfig(t *testing.T) *SubscriberSnapshotTestSuiteConfig + // SubscriberSubscriptionTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + SubscriptionTestSuiteConfig(t *testing.T) *SubscriberSubscriptionTestSuiteConfig +} + +// TestSubscriber is the main entrypoint for starting the AIP tests. +func TestSubscriber(t *testing.T, s SubscriberTestSuiteConfigProvider) { + testSubscriberSnapshotTestSuiteConfig(t, s) + testSubscriberSubscriptionTestSuiteConfig(t, s) +} + +func testSubscriberSnapshotTestSuiteConfig(t *testing.T, s SubscriberTestSuiteConfigProvider) { + t.Run("Snapshot", func(t *testing.T) { + config := s.SnapshotTestSuiteConfig(t) + if config == nil { + t.Skip("Method SnapshotTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method SubscriberSnapshotTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testSubscriberSubscriptionTestSuiteConfig(t *testing.T, s SubscriberTestSuiteConfigProvider) { + t.Run("Subscription", func(t *testing.T) { + config := s.SubscriptionTestSuiteConfig(t) + if config == nil { + t.Skip("Method SubscriptionTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method SubscriberSubscriptionTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type SubscriberTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/pubsub/apiv1/pubsubpb/schema_aiptest.pb.go b/proto/gen/googleapis/pubsub/apiv1/pubsubpb/schema_aiptest.pb.go index 03b482b2..2a42410b 100644 --- a/proto/gen/googleapis/pubsub/apiv1/pubsubpb/schema_aiptest.pb.go +++ b/proto/gen/googleapis/pubsub/apiv1/pubsubpb/schema_aiptest.pb.go @@ -13,6 +13,34 @@ import ( testing "testing" ) +// SchemaServiceTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type SchemaServiceTestSuiteConfigProvider interface { + // SchemaServiceSchemaTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + SchemaTestSuiteConfig(t *testing.T) *SchemaServiceSchemaTestSuiteConfig +} + +// TestSchemaService is the main entrypoint for starting the AIP tests. +func TestSchemaService(t *testing.T, s SchemaServiceTestSuiteConfigProvider) { + testSchemaServiceSchemaTestSuiteConfig(t, s) +} + +func testSchemaServiceSchemaTestSuiteConfig(t *testing.T, s SchemaServiceTestSuiteConfigProvider) { + t.Run("Schema", func(t *testing.T) { + config := s.SchemaTestSuiteConfig(t) + if config == nil { + t.Skip("Method SchemaTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method SchemaServiceSchemaTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type SchemaServiceTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/scheduler/apiv1/schedulerpb/cloudscheduler_aiptest.pb.go b/proto/gen/googleapis/scheduler/apiv1/schedulerpb/cloudscheduler_aiptest.pb.go index 7ce08e45..cae82675 100644 --- a/proto/gen/googleapis/scheduler/apiv1/schedulerpb/cloudscheduler_aiptest.pb.go +++ b/proto/gen/googleapis/scheduler/apiv1/schedulerpb/cloudscheduler_aiptest.pb.go @@ -14,6 +14,34 @@ import ( testing "testing" ) +// CloudSchedulerTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type CloudSchedulerTestSuiteConfigProvider interface { + // CloudSchedulerJobTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + JobTestSuiteConfig(t *testing.T) *CloudSchedulerJobTestSuiteConfig +} + +// TestCloudScheduler is the main entrypoint for starting the AIP tests. +func TestCloudScheduler(t *testing.T, s CloudSchedulerTestSuiteConfigProvider) { + testCloudSchedulerJobTestSuiteConfig(t, s) +} + +func testCloudSchedulerJobTestSuiteConfig(t *testing.T, s CloudSchedulerTestSuiteConfigProvider) { + t.Run("Job", func(t *testing.T) { + config := s.JobTestSuiteConfig(t) + if config == nil { + t.Skip("Method JobTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method CloudSchedulerJobTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type CloudSchedulerTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/spanner/admin/database/apiv1/databasepb/spanner_database_admin_aiptest.pb.go b/proto/gen/googleapis/spanner/admin/database/apiv1/databasepb/spanner_database_admin_aiptest.pb.go index 7c0fc815..f2cc5531 100644 --- a/proto/gen/googleapis/spanner/admin/database/apiv1/databasepb/spanner_database_admin_aiptest.pb.go +++ b/proto/gen/googleapis/spanner/admin/database/apiv1/databasepb/spanner_database_admin_aiptest.pb.go @@ -15,6 +15,72 @@ import ( testing "testing" ) +// DatabaseAdminTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type DatabaseAdminTestSuiteConfigProvider interface { + // DatabaseAdminBackupTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + BackupTestSuiteConfig(t *testing.T) *DatabaseAdminBackupTestSuiteConfig + // DatabaseAdminDatabaseTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DatabaseTestSuiteConfig(t *testing.T) *DatabaseAdminDatabaseTestSuiteConfig + // DatabaseAdminDatabaseRoleTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + DatabaseRoleTestSuiteConfig(t *testing.T) *DatabaseAdminDatabaseRoleTestSuiteConfig +} + +// TestDatabaseAdmin is the main entrypoint for starting the AIP tests. +func TestDatabaseAdmin(t *testing.T, s DatabaseAdminTestSuiteConfigProvider) { + testDatabaseAdminBackupTestSuiteConfig(t, s) + testDatabaseAdminDatabaseTestSuiteConfig(t, s) + testDatabaseAdminDatabaseRoleTestSuiteConfig(t, s) +} + +func testDatabaseAdminBackupTestSuiteConfig(t *testing.T, s DatabaseAdminTestSuiteConfigProvider) { + t.Run("Backup", func(t *testing.T) { + config := s.BackupTestSuiteConfig(t) + if config == nil { + t.Skip("Method BackupTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatabaseAdminBackupTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testDatabaseAdminDatabaseTestSuiteConfig(t *testing.T, s DatabaseAdminTestSuiteConfigProvider) { + t.Run("Database", func(t *testing.T) { + config := s.DatabaseTestSuiteConfig(t) + if config == nil { + t.Skip("Method DatabaseTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatabaseAdminDatabaseTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testDatabaseAdminDatabaseRoleTestSuiteConfig(t *testing.T, s DatabaseAdminTestSuiteConfigProvider) { + t.Run("DatabaseRole", func(t *testing.T) { + config := s.DatabaseRoleTestSuiteConfig(t) + if config == nil { + t.Skip("Method DatabaseRoleTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method DatabaseAdminDatabaseRoleTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type DatabaseAdminTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/spanner/admin/instance/apiv1/instancepb/spanner_instance_admin_aiptest.pb.go b/proto/gen/googleapis/spanner/admin/instance/apiv1/instancepb/spanner_instance_admin_aiptest.pb.go index bb2926c4..cc92f93f 100644 --- a/proto/gen/googleapis/spanner/admin/instance/apiv1/instancepb/spanner_instance_admin_aiptest.pb.go +++ b/proto/gen/googleapis/spanner/admin/instance/apiv1/instancepb/spanner_instance_admin_aiptest.pb.go @@ -15,6 +15,72 @@ import ( testing "testing" ) +// InstanceAdminTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type InstanceAdminTestSuiteConfigProvider interface { + // InstanceAdminInstanceTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + InstanceTestSuiteConfig(t *testing.T) *InstanceAdminInstanceTestSuiteConfig + // InstanceAdminInstanceConfigTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + InstanceConfigTestSuiteConfig(t *testing.T) *InstanceAdminInstanceConfigTestSuiteConfig + // InstanceAdminInstancePartitionTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + InstancePartitionTestSuiteConfig(t *testing.T) *InstanceAdminInstancePartitionTestSuiteConfig +} + +// TestInstanceAdmin is the main entrypoint for starting the AIP tests. +func TestInstanceAdmin(t *testing.T, s InstanceAdminTestSuiteConfigProvider) { + testInstanceAdminInstanceTestSuiteConfig(t, s) + testInstanceAdminInstanceConfigTestSuiteConfig(t, s) + testInstanceAdminInstancePartitionTestSuiteConfig(t, s) +} + +func testInstanceAdminInstanceTestSuiteConfig(t *testing.T, s InstanceAdminTestSuiteConfigProvider) { + t.Run("Instance", func(t *testing.T) { + config := s.InstanceTestSuiteConfig(t) + if config == nil { + t.Skip("Method InstanceTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method InstanceAdminInstanceTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testInstanceAdminInstanceConfigTestSuiteConfig(t *testing.T, s InstanceAdminTestSuiteConfigProvider) { + t.Run("InstanceConfig", func(t *testing.T) { + config := s.InstanceConfigTestSuiteConfig(t) + if config == nil { + t.Skip("Method InstanceConfigTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method InstanceAdminInstanceConfigTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + +func testInstanceAdminInstancePartitionTestSuiteConfig(t *testing.T, s InstanceAdminTestSuiteConfigProvider) { + t.Run("InstancePartition", func(t *testing.T) { + config := s.InstancePartitionTestSuiteConfig(t) + if config == nil { + t.Skip("Method InstancePartitionTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method InstanceAdminInstancePartitionTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type InstanceAdminTestSuite struct { T *testing.T // Server to test. diff --git a/proto/gen/googleapis/spanner/apiv1/spannerpb/spanner_aiptest.pb.go b/proto/gen/googleapis/spanner/apiv1/spannerpb/spanner_aiptest.pb.go index d7629ff6..1f08034a 100644 --- a/proto/gen/googleapis/spanner/apiv1/spannerpb/spanner_aiptest.pb.go +++ b/proto/gen/googleapis/spanner/apiv1/spannerpb/spanner_aiptest.pb.go @@ -12,6 +12,34 @@ import ( testing "testing" ) +// SpannerTestSuiteConfigProvider is the interface to implement to decide which resources +// that should be tested and how it's configured. +type SpannerTestSuiteConfigProvider interface { + // SpannerSessionTestSuiteConfig should return a config, or nil, which means that the tests will be skipped. + SessionTestSuiteConfig(t *testing.T) *SpannerSessionTestSuiteConfig +} + +// TestSpanner is the main entrypoint for starting the AIP tests. +func TestSpanner(t *testing.T, s SpannerTestSuiteConfigProvider) { + testSpannerSessionTestSuiteConfig(t, s) +} + +func testSpannerSessionTestSuiteConfig(t *testing.T, s SpannerTestSuiteConfigProvider) { + t.Run("Session", func(t *testing.T) { + config := s.SessionTestSuiteConfig(t) + if config == nil { + t.Skip("Method SessionTestSuiteConfig not implemented") + } + if config.Service == nil { + t.Skip("Method SpannerSessionTestSuiteConfig.Service() not implemented") + } + if config.Context == nil { + config.Context = func() context.Context { return context.Background() } + } + config.test(t) + }) +} + type SpannerTestSuite struct { T *testing.T // Server to test.