Skip to content

Commit

Permalink
test(internal): add test for gapic pkg path (#3590)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbpg committed May 11, 2021
1 parent 661610a commit aebf043
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/gapicgen/generator/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ var apivExceptions = map[string]bool{
"cloud.google.com/go/monitoring/apiv3/v2": true,
}

var packagePathExceptions = map[string]bool{
"cloud.google.com/go/longrunning/autogen": true,
"cloud.google.com/go/firestore/apiv1/admin": true,
}

// TestMicrogenConfigs validates config entries.
// We expect entries here to have reasonable production settings, whereas
// the low level tooling is more permissive in the face of ambiguity.
Expand All @@ -49,6 +54,9 @@ func TestMicrogenConfigs(t *testing.T) {
if !strings.HasPrefix(v, "apiv") && !apivExceptions[entry.importPath] {
t.Errorf("config %q (#%d) expected the last part of import path %q to start with \"apiv\"", entry.inputDirectoryPath, k, entry.importPath)
}
if want := entry.pkg + "/apiv"; !strings.Contains(entry.importPath, want) && !packagePathExceptions[entry.importPath] {
t.Errorf("config %q (#%d) want import path to contain %q", entry.importPath, k, want)
}
if entry.inputDirectoryPath == "" {
t.Errorf("config %q (#%d) expected non-empty inputDirectoryPath field", entry.importPath, k)
}
Expand Down

0 comments on commit aebf043

Please sign in to comment.