Skip to content

Commit e9fc828

Browse files
tests: another test for adding a new api path to an existing library (#2676)
As a follow up to #2666, this PR adds another test case to check that a new API path can be added to an existing library in state.yaml. The test case added in #2666 did not have any API paths in the existing library. See the snippet below where there is no API path in the existing library. https://github.com/googleapis/librarian/blob/50046f559ee7cdcc4115ae790c7218a09c7fd9ae/internal/librarian/generate_command_test.go#L1572-L1584 For completeness and to avoid regressions, we should also test that new paths can be added to an existing library which already has API paths. This PR adds the missing test case. --------- Signed-off-by: Anthonios Partheniou <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent e0cb0ff commit e9fc828

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

internal/librarian/generate_command_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ func TestNeedsConfigure(t *testing.T) {
15701570
want: true,
15711571
},
15721572
{
1573-
name: "api and library set, library exists",
1573+
name: "api and library set library exists no api path in state yaml",
15741574
api: "some/api",
15751575
library: "some-library",
15761576
state: &config.LibrarianState{
@@ -1582,6 +1582,22 @@ func TestNeedsConfigure(t *testing.T) {
15821582
},
15831583
want: true,
15841584
},
1585+
{
1586+
name: "api and library set library exists different api path in state yaml",
1587+
api: "some/api",
1588+
library: "some-library",
1589+
state: &config.LibrarianState{
1590+
Libraries: []*config.LibraryState{
1591+
{
1592+
ID: "some-library",
1593+
APIs: []*config.API{
1594+
{Path: "another/api"},
1595+
},
1596+
},
1597+
},
1598+
},
1599+
want: true,
1600+
},
15851601
{
15861602
name: "api not set",
15871603
api: "",

0 commit comments

Comments
 (0)