Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the remaining tests into a test package #2396

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions from_dockerfile_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package testcontainers
package testcontainers_test

import (
"context"
Expand All @@ -12,10 +12,12 @@ import (
"github.com/docker/docker/api/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/testcontainers/testcontainers-go"
)

func TestBuildImageFromDockerfile(t *testing.T) {
provider, err := NewDockerProvider()
provider, err := testcontainers.NewDockerProvider()
if err != nil {
t.Fatal(err)
}
Expand All @@ -25,9 +27,9 @@ func TestBuildImageFromDockerfile(t *testing.T) {

ctx := context.Background()

tag, err := provider.BuildImage(ctx, &ContainerRequest{
tag, err := provider.BuildImage(ctx, &testcontainers.ContainerRequest{
// fromDockerfileIncludingRepo {
FromDockerfile: FromDockerfile{
FromDockerfile: testcontainers.FromDockerfile{
Context: "testdata",
Dockerfile: "echo.Dockerfile",
Repo: "test-repo",
Expand All @@ -53,7 +55,7 @@ func TestBuildImageFromDockerfile(t *testing.T) {
}

func TestBuildImageFromDockerfile_NoRepo(t *testing.T) {
provider, err := NewDockerProvider()
provider, err := testcontainers.NewDockerProvider()
if err != nil {
t.Fatal(err)
}
Expand All @@ -63,8 +65,8 @@ func TestBuildImageFromDockerfile_NoRepo(t *testing.T) {

ctx := context.Background()

tag, err := provider.BuildImage(ctx, &ContainerRequest{
FromDockerfile: FromDockerfile{
tag, err := provider.BuildImage(ctx, &testcontainers.ContainerRequest{
FromDockerfile: testcontainers.FromDockerfile{
Context: "testdata",
Dockerfile: "echo.Dockerfile",
Repo: "test-repo",
Expand All @@ -88,7 +90,7 @@ func TestBuildImageFromDockerfile_NoRepo(t *testing.T) {
}

func TestBuildImageFromDockerfile_NoTag(t *testing.T) {
provider, err := NewDockerProvider()
provider, err := testcontainers.NewDockerProvider()
if err != nil {
t.Fatal(err)
}
Expand All @@ -98,8 +100,8 @@ func TestBuildImageFromDockerfile_NoTag(t *testing.T) {

ctx := context.Background()

tag, err := provider.BuildImage(ctx, &ContainerRequest{
FromDockerfile: FromDockerfile{
tag, err := provider.BuildImage(ctx, &testcontainers.ContainerRequest{
FromDockerfile: testcontainers.FromDockerfile{
Context: "testdata",
Dockerfile: "echo.Dockerfile",
Tag: "test-tag",
Expand All @@ -126,9 +128,9 @@ func TestBuildImageFromDockerfile_Target(t *testing.T) {
// there are thre targets: target0, target1 and target2.
for i := 0; i < 3; i++ {
ctx := context.Background()
c, err := GenericContainer(ctx, GenericContainerRequest{
ContainerRequest: ContainerRequest{
FromDockerfile: FromDockerfile{
c, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{
FromDockerfile: testcontainers.FromDockerfile{
Context: "testdata",
Dockerfile: "target.Dockerfile",
PrintBuildLog: true,
Expand Down Expand Up @@ -160,9 +162,9 @@ func ExampleGenericContainer_buildFromDockerfile() {
ctx := context.Background()

// buildFromDockerfileWithModifier {
c, err := GenericContainer(ctx, GenericContainerRequest{
ContainerRequest: ContainerRequest{
FromDockerfile: FromDockerfile{
c, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{
FromDockerfile: testcontainers.FromDockerfile{
Context: "testdata",
Dockerfile: "target.Dockerfile",
PrintBuildLog: true,
Expand Down Expand Up @@ -199,9 +201,9 @@ func TestBuildImageFromDockerfile_TargetDoesNotExist(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()

_, err := GenericContainer(ctx, GenericContainerRequest{
ContainerRequest: ContainerRequest{
FromDockerfile: FromDockerfile{
_, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{
FromDockerfile: testcontainers.FromDockerfile{
Context: "testdata",
Dockerfile: "target.Dockerfile",
PrintBuildLog: true,
Expand Down
2 changes: 2 additions & 0 deletions generic_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// 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 (
Expand Down
2 changes: 2 additions & 0 deletions image_substitutors_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// 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 (
Expand Down
2 changes: 2 additions & 0 deletions image_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// 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 (
Expand Down
Loading
Loading