chore: update yaml tag for tools

This commit is contained in:
Yuan Teoh
2026-01-22 17:11:12 -08:00
parent ad8df40791
commit 7f0c49a4df
369 changed files with 4707 additions and 5752 deletions

View File

@@ -17,7 +17,6 @@ package cloudsqlcreateusers_test
import (
"testing"
"github.com/goccy/go-yaml"
"github.com/google/go-cmp/cmp"
"github.com/googleapis/genai-toolbox/internal/server"
"github.com/googleapis/genai-toolbox/internal/testutils"
@@ -37,11 +36,11 @@ func TestParseFromYaml(t *testing.T) {
{
desc: "basic example",
in: `
tools:
create-user:
kind: cloud-sql-create-users
source: my-source
description: some description
kind: tools
name: create-user
type: cloud-sql-create-users
source: my-source
description: some description
`,
want: server.ToolConfigs{
"create-user": cloudsqlcreateusers.Config{
@@ -56,15 +55,11 @@ func TestParseFromYaml(t *testing.T) {
}
for _, tc := range tcs {
t.Run(tc.desc, func(t *testing.T) {
got := struct {
Tools server.ToolConfigs `yaml:"tools"`
}{}
// Parse contents
err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got)
_, _, _, got, _, _, err := server.UnmarshalResourceConfig(ctx, testutils.FormatYaml(tc.in))
if err != nil {
t.Fatalf("unable to unmarshal: %s", err)
}
if diff := cmp.Diff(tc.want, got.Tools); diff != "" {
if diff := cmp.Diff(tc.want, got); diff != "" {
t.Fatalf("incorrect parse: diff %v", diff)
}
})