Repository: googleapis/genai-toolbox
File: internal/tools/oracle/oraclesql/oraclesql_test.go (Go)

Code before:
                get_orders:
                    kind: oracle-sql
                    source: db-prod
                    description: Gets orders for a customer with optional filtering.
                    statement: "SELECT * FROM ${SCHEMA}.ORDERS WHERE customer_id = :customer_id AND status = :status"
            `,
			want: server.ToolConfigs{
				"get_orders": oraclesql.Config{
					Name:         "get_orders",
					Kind:         "oracle-sql",
					Source:       "db-prod",
					Description:  "Gets orders for a customer with optional filtering.",
					Statement:    "SELECT * FROM ${SCHEMA}.ORDERS WHERE customer_id = :customer_id AND status = :status",
					AuthRequired: []string{},
				},
			},
		},
		{
			desc: "example with readonly flag set to false (DML)",
			in: `
            tools:
                update_user:
                    kind: oracle-sql
                    source: db-prod
                    description: Updates user email.
                    readonly: false   # <--- We are testing this specific line
                    statement: "UPDATE users SET email = :1 WHERE id = :2"
            `,
			want: server.ToolConfigs{
				"update_user": oraclesql.Config{
					Name:         "update_user",
					Kind:         "oracle-sql",
					Source:       "db-prod",
					Description:  "Updates user email.",
					Statement:    "UPDATE users SET email = :1 WHERE id = :2",
					ReadOnly:     boolPtr(false),
					AuthRequired: []string{},
				},
			},
		},
	}
	for _, tc := range tcs {
		t.Run(tc.desc, func(t *testing.T) {
			got := struct {
				Tools server.ToolConfigs `yaml:"tools"`
			}{}

			err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got)
			if err != nil {
				t.Fatalf("unable to unmarshal: %s", err)
			}

Review comment (suggestion):
```suggestion
                    readOnly: false   # <--- We are testing this specific line
```

Code after:
            name: get_orders
            type: oracle-sql
            source: db-prod
            description: Gets orders for a customer with optional filtering.
            statement: "SELECT * FROM ${SCHEMA}.ORDERS WHERE customer_id = :customer_id AND status = :status"
            `,
			want: server.ToolConfigs{
				"get_orders": oraclesql.Config{
					Name:         "get_orders",
					Type:         "oracle-sql",
					Source:       "db-prod",
					Description:  "Gets orders for a customer with optional filtering.",
					Statement:    "SELECT * FROM ${SCHEMA}.ORDERS WHERE customer_id = :customer_id AND status = :status",
					ReadOnly:     nil,
					AuthRequired: []string{},
				},
			},
		},
		{
			desc: "explicit: readOnly set to true",
			in: `
			kind: tools
			name: safe_query
			type: oracle-sql
			source: db-prod
			description: Safe read operation.
			readOnly: true
			statement: "SELECT * FROM orders"
			`,
			want: server.ToolConfigs{
				"safe_query": oraclesql.Config{
					Name:         "safe_query",
					Type:         "oracle-sql",
					Source:       "db-prod",
					Description:  "Safe read operation.",
					Statement:    "SELECT * FROM orders",
					ReadOnly:     &valTrue,
					AuthRequired: []string{},
				},
			},
		},
		{
			desc: "example with readonly flag set to false (DML)",
			in: `
			kind: tools
			name: update_user
			type: oracle-sql
			source: db-prod
			description: Updates user email.
			readOnly: false
			statement: "UPDATE users SET email = :1 WHERE id = :2"