MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / TestSpec_VersionString

Function TestSpec_VersionString

cli/internal/specs/v0/source_test.go:208–263  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

206}
207
208func TestSpec_VersionString(t *testing.T) {
209 tests := []struct {
210 name string
211 meta Metadata
212 want string
213 }{
214 {
215 name: "should use short version without name part in path when those are the same",
216 meta: Metadata{
217 Name: "aws",
218 Version: "v10.0.0",
219 Path: "cloudquery/aws",
220 Registry: RegistryCloudQuery,
221 },
222 want: "aws (cloudquery/aws@v10.0.0)",
223 },
224 {
225 name: "should use long version with path when name doesn't match path",
226 meta: Metadata{
227 Name: "my-aws-spec",
228 Version: "v10.0.0",
229 Path: "cloudquery/aws",
230 Registry: RegistryCloudQuery,
231 },
232 want: "my-aws-spec (cloudquery/aws@v10.0.0)",
233 },
234 {
235 name: "should handle non CloudQuery registry",
236 meta: Metadata{
237 Name: "my-aws-spec",
238 Version: "v10.0.0",
239 Path: "localhost:7777",
240 Registry: RegistryGRPC,
241 },
242 want: "my-aws-spec (grpc@localhost:7777)",
243 },
244 {
245 name: "should handle malformed path",
246 meta: Metadata{
247 Name: "my-aws-spec",
248 Version: "v10.0.0",
249 Path: "aws",
250 Registry: RegistryCloudQuery,
251 },
252 want: "my-aws-spec (aws@v10.0.0)",
253 },
254 }
255 for _, tt := range tests {
256 t.Run(tt.name, func(t *testing.T) {
257 s := Source{Metadata: tt.meta}
258 if got := s.VersionString(); got != tt.want {
259 t.Errorf("Source.String() = %v, want %v", got, tt.want)
260 }
261 })
262 }
263}
264
265func TestBackendOptions_JSONSchema(t *testing.T) {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
VersionStringMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected