(t *testing.T)
| 446 | } |
| 447 | |
| 448 | func TestParseURI_S3BucketOnly(t *testing.T) { |
| 449 | t.Parallel() |
| 450 | |
| 451 | testUri := func(cstr string, pathExpected string, pathWithHostExpected string) { |
| 452 | c, err := connparse.ParseURI(cstr) |
| 453 | if err != nil { |
| 454 | t.Fatalf("failed to parse URI: %v", err) |
| 455 | } |
| 456 | if c.Path != pathExpected { |
| 457 | t.Fatalf("expected path to be \"%q\", got \"%q\"", pathExpected, c.Path) |
| 458 | } |
| 459 | expected := "bucket" |
| 460 | if c.Host != expected { |
| 461 | t.Fatalf("expected host to be \"%q\", got \"%q\"", expected, c.Host) |
| 462 | } |
| 463 | pathWithHost := c.GetPathWithHost() |
| 464 | if pathWithHost != pathWithHostExpected { |
| 465 | t.Fatalf("expected path with host to be \"%q\", got \"%q\"", expected, pathWithHost) |
| 466 | } |
| 467 | expected = "s3" |
| 468 | if c.GetType() != expected { |
| 469 | t.Fatalf("expected conn type to be \"%q\", got \"%q\"", expected, c.GetType()) |
| 470 | } |
| 471 | if len(c.GetSchemeParts()) != 2 { |
| 472 | t.Fatalf("expected scheme parts to be 2, got %d", len(c.GetSchemeParts())) |
| 473 | } |
| 474 | fullUri := c.GetFullURI() |
| 475 | if fullUri != cstr { |
| 476 | t.Fatalf("expected full URI to be \"%q\", got \"%q\"", cstr, fullUri) |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | t.Log("Testing with no trailing slash") |
| 481 | testUri("profile:s3://bucket", "", "bucket") |
| 482 | t.Log("Testing with trailing slash") |
| 483 | testUri("profile:s3://bucket/", "/", "bucket/") |
| 484 | } |
nothing calls this directly
no test coverage detected