You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

55 lines
1.3 KiB

  1. // Copyright 2019 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package kms_test
  15. import (
  16. "context"
  17. "fmt"
  18. "log"
  19. "testing"
  20. "cloud.google.com/go/internal/testutil"
  21. kms "cloud.google.com/go/kms/apiv1"
  22. "google.golang.org/api/iterator"
  23. kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1"
  24. )
  25. func TestIntegration(t *testing.T) {
  26. if testing.Short() {
  27. t.Skip("skipping integration test in short mode")
  28. }
  29. ctx := context.Background()
  30. projectID := testutil.ProjID()
  31. c, err := kms.NewKeyManagementClient(ctx)
  32. if err != nil {
  33. panic(err)
  34. }
  35. it := c.ListKeyRings(ctx, &kmspb.ListKeyRingsRequest{
  36. Parent: fmt.Sprintf("projects/%s/locations/global", projectID),
  37. })
  38. for {
  39. _, err := it.Next()
  40. if err == iterator.Done {
  41. break
  42. }
  43. if err != nil {
  44. log.Fatal(err)
  45. }
  46. }
  47. }