Exemplo n.º 1
0
 public PubsubFixture()
 {
     GrpcInfo.EnableSubchannelCounting();
     _projectNumber = new Lazy <Task <string> >(async() =>
     {
         var cred = await GoogleCredential.GetApplicationDefaultAsync().ConfigureAwait(false);
         cred     = cred.CreateScoped(CloudResourceManagerService.Scope.CloudPlatformReadOnly);
         var crm  = new CloudResourceManagerService(new BaseClientService.Initializer
         {
             HttpClientInitializer = cred,
             ApplicationName       = "pubsub integration test",
         });
         var project = await crm.Projects.Get(ProjectId).ExecuteAsync().ConfigureAwait(false);
         return(project.ProjectNumber.ToString());
     });
 }
Exemplo n.º 2
0
        public BigtableFixtureBase()
        {
            GrpcInfo.EnableSubchannelCounting();

            string emulatorHost = Environment.GetEnvironmentVariable(EmulatorEnvironmentVariable);

            string projectId;
            string instanceId;

            if (!string.IsNullOrEmpty(emulatorHost))
            {
                projectId           = "emulator-test-project";
                EmulatorCallInvoker = new GcpCallInvoker(
                    emulatorHost,
                    ChannelCredentials.Insecure,
                    GrpcCoreAdapter.Instance.ConvertOptions(BigtableServiceApiSettings.GetDefault().CreateChannelOptions()));

                instanceId = "doesnt-matter";
            }
            else
            {
                projectId = Environment.GetEnvironmentVariable(TestProjectEnvironmentVariable);
                if (string.IsNullOrEmpty(projectId))
                {
                    throw new InvalidOperationException(
                              $"Please set either the {EmulatorEnvironmentVariable} or {TestProjectEnvironmentVariable} environment variable before running tests");
                }

                instanceId = Environment.GetEnvironmentVariable(TestInstanceEnvironmentVariable);
                if (string.IsNullOrEmpty(instanceId))
                {
                    throw new InvalidOperationException(
                              $"Please set the {TestInstanceEnvironmentVariable} environment variable before running non-emulator tests.");
                }
            }

            ProjectName  = new ProjectName(projectId);
            InstanceName = new InstanceName(projectId, instanceId);

            Task.Run(InitBigtableInstanceAndTable).Wait();
        }
 public SpannerFixtureBase()
 {
     GrpcInfo.EnableSubchannelCounting();
     Database = SpannerTestDatabase.GetInstance(ProjectId);
 }
Exemplo n.º 4
0
 public PubsubFixture()
 {
     GrpcInfo.EnableSubchannelCounting();
 }
 public SpannerDatabaseFixture()
 {
     GrpcInfo.EnableSubchannelCounting();
 }