Skip to content

Commit 8804db4

Browse files
authored
fix(internal/librarian/golang): update generator tests and ci (#5305)
To support these tests in the continuous integration environment, a new step is added to the librarian workflow to install the Go generator tools using the librarian CLI. This ensures that the necessary binaries are available for the generation process during test execution. The generator tests in internal/librarian/golang are updated to use consistent library names and expected paths. Before this change, this test is not running in CI because the generator is not installed in CI.
1 parent 69ec192 commit 8804db4

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

.github/workflows/librarian.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
steps:
5050
- uses: actions/checkout@v6
5151
- uses: ./.github/actions/setup-librarian
52+
- name: Install tools
53+
run: |
54+
go run ./cmd/librarian install go
5255
- name: Run tests and check coverage
5356
run: |
5457
go run ./tool/cmd/coverage \

internal/librarian/golang/generate_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ func TestGenerateLibrary(t *testing.T) {
392392
},
393393
},
394394
{
395-
name: "multi api",
395+
name: "multiple apis",
396396
library: &config.Library{
397-
Name: "secretmanager-multi",
397+
Name: "secretmanager",
398398
APIs: []*config.API{
399399
{Path: "google/cloud/secretmanager/v1"},
400400
{Path: "google/cloud/secretmanager/v1beta2"},
@@ -403,26 +403,26 @@ func TestGenerateLibrary(t *testing.T) {
403403
GoAPIs: []*config.GoAPI{
404404
{
405405
ClientPackage: "secretmanager",
406-
ImportPath: "secretmanager-multi/apiv1",
406+
ImportPath: "secretmanager/apiv1",
407407
Path: "google/cloud/secretmanager/v1",
408408
},
409409
{
410410
ClientPackage: "secretmanager",
411-
ImportPath: "secretmanager-multi/apiv1beta2",
411+
ImportPath: "secretmanager/apiv1beta2",
412412
Path: "google/cloud/secretmanager/v1beta2",
413413
},
414414
},
415415
},
416416
},
417417
want: []string{
418-
"secretmanager-multi/apiv1/secret_manager_client.go",
419-
"secretmanager-multi/apiv1/secretmanagerpb/service.pb.go",
420-
"secretmanager-multi/apiv1/version.go",
421-
"secretmanager-multi/apiv1beta2/secret_manager_client.go",
422-
"secretmanager-multi/apiv1beta2/secretmanagerpb/service.pb.go",
423-
"secretmanager-multi/apiv1beta2/version.go",
424-
"secretmanager-multi/internal/version.go",
425-
"secretmanager-multi/README.md",
418+
"secretmanager/apiv1/secret_manager_client.go",
419+
"secretmanager/apiv1/secretmanagerpb/service.pb.go",
420+
"secretmanager/apiv1/version.go",
421+
"secretmanager/apiv1beta2/secret_manager_client.go",
422+
"secretmanager/apiv1beta2/secretmanagerpb/service.pb.go",
423+
"secretmanager/apiv1beta2/version.go",
424+
"secretmanager/internal/version.go",
425+
"secretmanager/README.md",
426426
},
427427
},
428428
{

0 commit comments

Comments
 (0)