forked from testcontainers/testcontainers-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/options-error
* main: (21 commits) feat: optimizes file copies to and from containers (testcontainers#2450) fix(exec): updates the `Multiplexed` opt to combine stdout and stderr (testcontainers#2452) Upgrade neo4j module to use features from v0.29.1 of testcontainers-go (testcontainers#2463) bug:Fix AMQPS url (testcontainers#2462) chore: more compose updates in comments chore: use "docker compose" (v2) instead of "docker-compose" (v1) (testcontainers#2464) chore(deps): bump github/codeql-action from 2.22.12 to 3.24.9 (testcontainers#2459) refactor: Add Weaviate modules tests (testcontainers#2447) feat(exitcode): Add exit code sugar method (testcontainers#2342) feat: add module to support InfluxDB v1.x (testcontainers#1703) feat: authenticate docker on PullImage (testcontainers#2446) feat: add distribution-registry module (testcontainers#2341) chore(deps): Bumping ChromaGo client version (testcontainers#2402) chore(deps): bump github.com/docker/docker from 25.0.3+incompatible to 25.0.5+incompatible (testcontainers#2444) feat: support passing io.Reader as ContainerFile (testcontainers#2401) chore: bump ryuk to latest (testcontainers#2395) feat(MustConn): Add MustConnectionString on (some) dbs (testcontainers#2343) fix: typo in ci-test-go.yml (testcontainers#2394) feat: support for waiting for response headers (testcontainers#2349) chore(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (testcontainers#2392) ...
- Loading branch information
Showing
172 changed files
with
3,053 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ src/pip-delete-this-directory.txt | |
.DS_Store | ||
|
||
TEST-*.xml | ||
|
||
**/go.work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// This test is testing very internal logic that should not be exported away from this package. We'll | ||
// leave it in the main testcontainers package. Do not use for user facing examples. | ||
package testcontainers | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestContainerFileValidation(t *testing.T) { | ||
type ContainerFileValidationTestCase struct { | ||
Name string | ||
ExpectedError error | ||
File ContainerFile | ||
} | ||
|
||
f, err := os.Open(filepath.Join(".", "testdata", "hello.sh")) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
testTable := []ContainerFileValidationTestCase{ | ||
{ | ||
Name: "valid container file: has hostfilepath", | ||
File: ContainerFile{ | ||
HostFilePath: "/path/to/host", | ||
ContainerFilePath: "/path/to/container", | ||
}, | ||
}, | ||
{ | ||
Name: "valid container file: has reader", | ||
File: ContainerFile{ | ||
Reader: f, | ||
ContainerFilePath: "/path/to/container", | ||
}, | ||
}, | ||
{ | ||
Name: "invalid container file", | ||
ExpectedError: errors.New("either HostFilePath or Reader must be specified"), | ||
File: ContainerFile{ | ||
HostFilePath: "", | ||
Reader: nil, | ||
ContainerFilePath: "/path/to/container", | ||
}, | ||
}, | ||
{ | ||
Name: "invalid container file", | ||
ExpectedError: errors.New("ContainerFilePath must be specified"), | ||
File: ContainerFile{ | ||
HostFilePath: "/path/to/host", | ||
ContainerFilePath: "", | ||
}, | ||
}, | ||
} | ||
|
||
for _, testCase := range testTable { | ||
t.Run(testCase.Name, func(t *testing.T) { | ||
err := testCase.File.validate() | ||
switch { | ||
case err == nil && testCase.ExpectedError == nil: | ||
return | ||
case err == nil && testCase.ExpectedError != nil: | ||
t.Errorf("did not receive expected error: %s", testCase.ExpectedError.Error()) | ||
case err != nil && testCase.ExpectedError == nil: | ||
t.Errorf("received unexpected error: %s", err.Error()) | ||
case err.Error() != testCase.ExpectedError.Error(): | ||
t.Errorf("errors mismatch: %s != %s", err.Error(), testCase.ExpectedError.Error()) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.