chore: update yaml tag for tools

This commit is contained in:
Yuan Teoh
2026-01-22 17:10:44 -08:00
parent ad8df40791
commit d19bbd1365
369 changed files with 4707 additions and 5752 deletions

View File

@@ -18,7 +18,6 @@ import (
//"context"
"testing"
yaml "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"
@@ -38,11 +37,11 @@ func TestParseFromYaml(t *testing.T) {
{
desc: "basic example",
in: `
tools:
clone-instance-tool:
kind: cloud-sql-clone-instance
description: a test description
source: a-source
kind: tools
name: clone-instance-tool
type: cloud-sql-clone-instance
description: a test description
source: a-source
`,
want: server.ToolConfigs{
"clone-instance-tool": cloudsqlcloneinstance.Config{
@@ -57,15 +56,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)
}
})