Skip to content

Commit

Permalink
Running the rest of the tests in Parallel
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Bustamante <[email protected]>
  • Loading branch information
jjbustamante committed Apr 2, 2024
1 parent 6745c1c commit d7596e5
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 21 deletions.
27 changes: 18 additions & 9 deletions index/new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,28 @@ import (
)

func TestRemoteNew(t *testing.T) {
spec.Run(t, "RemoteNew", testRemoteNew, spec.Sequential(), spec.Report(report.Terminal{}))
spec.Run(t, "RemoteNew", testRemoteNew, spec.Parallel(), spec.Report(report.Terminal{}))
}

func testRemoteNew(t *testing.T, when spec.G, it spec.S) {
var (
idx imgutil.ImageIndex
xdgPath string
err error
)

it.Before(func() {
// creates the directory to save all the OCI images on disk
xdgPath, err = os.MkdirTemp("", "image-indexes")
h.AssertNil(t, err)
})

it.After(func() {
err := os.RemoveAll(xdgPath)
h.AssertNil(t, err)
})

when("#NewIndex", func() {
var (
idx imgutil.ImageIndex
err error
xdgPath = "xdgPath"
)
it.After(func() {
h.AssertNil(t, os.RemoveAll(xdgPath))
})
it("should have expected indexOptions", func() {
idx, err = index.NewIndex("repo/name", index.WithInsecure(true), index.WithXDGRuntimePath(xdgPath))
h.AssertNil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion index/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func TestRemoteOptions(t *testing.T) {
spec.Run(t, "RemoteNew", testRemoteOptions, spec.Sequential(), spec.Report(report.Terminal{}))
spec.Run(t, "RemoteNew", testRemoteOptions, spec.Parallel(), spec.Report(report.Terminal{}))
}

func testRemoteOptions(t *testing.T, when spec.G, it spec.S) {
Expand Down
23 changes: 19 additions & 4 deletions layout/new_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package layout_test

import (
"os"
"testing"

v1 "github.com/google/go-containerregistry/pkg/v1"
Expand All @@ -15,17 +16,31 @@ import (
)

func TestRemoteNew(t *testing.T) {
spec.Run(t, "RemoteNew", testRemoteNew, spec.Sequential(), spec.Report(report.Terminal{}))
spec.Run(t, "RemoteNew", testRemoteNew, spec.Parallel(), spec.Report(report.Terminal{}))
}

var (
xdgPath = "xdgPath"
repoName = "some/index"
idx imgutil.ImageIndex
err error
)

func testRemoteNew(t *testing.T, when spec.G, it spec.S) {
var (
idx imgutil.ImageIndex
xdgPath string
err error
)

it.Before(func() {
// creates the directory to save all the OCI images on disk
xdgPath, err = os.MkdirTemp("", "image-indexes")
h.AssertNil(t, err)
})

it.After(func() {
err := os.RemoveAll(xdgPath)
h.AssertNil(t, err)
})

when("#NewIndex", func() {
it.Before(func() {
idx, err = index.NewIndex(
Expand Down
21 changes: 17 additions & 4 deletions local/new_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package local_test

import (
"os"
"testing"

v1 "github.com/google/go-containerregistry/pkg/v1"
Expand All @@ -15,19 +16,31 @@ import (
)

func TestRemoteNew(t *testing.T) {
spec.Run(t, "RemoteNew", testRemoteNew, spec.Sequential(), spec.Report(report.Terminal{}))
spec.Run(t, "RemoteNew", testRemoteNew, spec.Parallel(), spec.Report(report.Terminal{}))
}

var (
xdgPath = "xdgPath"
repoName = "some/index"
)

func testRemoteNew(t *testing.T, when spec.G, it spec.S) {
var (
idx imgutil.ImageIndex
err error
idx imgutil.ImageIndex
xdgPath string
err error
)

it.Before(func() {
// creates the directory to save all the OCI images on disk
xdgPath, err = os.MkdirTemp("", "image-indexes")
h.AssertNil(t, err)
})

it.After(func() {
err := os.RemoveAll(xdgPath)
h.AssertNil(t, err)
})

when("#NewIndex", func() {
it.Before(func() {
idx, err = index.NewIndex(
Expand Down
17 changes: 15 additions & 2 deletions remote/new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,26 @@ import (
)

func TestRemoteNew(t *testing.T) {
spec.Run(t, "RemoteNew", testRemoteNew, spec.Sequential(), spec.Report(report.Terminal{}))
spec.Run(t, "RemoteNew", testRemoteNew, spec.Parallel(), spec.Report(report.Terminal{}))
}

func testRemoteNew(t *testing.T, when spec.G, it spec.S) {
var (
xdgPath = "xdgPath"
xdgPath string
err error
)

it.Before(func() {
// creates the directory to save all the OCI images on disk
xdgPath, err = os.MkdirTemp("", "image-indexes")
h.AssertNil(t, err)
})

it.After(func() {
err := os.RemoveAll(xdgPath)
h.AssertNil(t, err)
})

when("#NewIndex", func() {
it.After(func() {
err := os.RemoveAll(xdgPath)
Expand Down
2 changes: 1 addition & 1 deletion util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func TestUtils(t *testing.T) {
spec.Run(t, "Utils", testUtils, spec.Sequential(), spec.Report(report.Terminal{}))
spec.Run(t, "Utils", testUtils, spec.Parallel(), spec.Report(report.Terminal{}))
}

type FakeIndentifier struct {
Expand Down

0 comments on commit d7596e5

Please sign in to comment.