Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
sudo ip addr

- name: Run Unit tests
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |-
# switch to installed go
sudo ln -sf `which go` `sudo which go`
Expand Down
11 changes: 11 additions & 0 deletions internal/job/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ package job

import (
"context"
"os"
"testing"
"time"

"github.com/stretchr/testify/assert"
)

func TestPreheat_CreatePreheatRequestsByManifestURL(t *testing.T) {
username := os.Getenv("DOCKER_USERNAME")
password := os.Getenv("DOCKER_PASSWORD")
if username == "" || password == "" {
t.Skip("DOCKER_USERNAME or DOCKER_PASSWORD is not set, skipping test")
}

tests := []struct {
name string
req *ManifestRequest
Expand All @@ -34,6 +41,8 @@ func TestPreheat_CreatePreheatRequestsByManifestURL(t *testing.T) {
name: "get image layers with manifest url",
req: &ManifestRequest{
URL: "https://registry-1.docker.io/v2/dragonflyoss/busybox/manifests/1.35.0",
Username: username,
Password: password,
Timeout: 30 * time.Second,
InsecureSkipVerify: true,
},
Expand All @@ -47,6 +56,8 @@ func TestPreheat_CreatePreheatRequestsByManifestURL(t *testing.T) {
req: &ManifestRequest{
URL: "https://registry-1.docker.io/v2/dragonflyoss/scheduler/manifests/v2.1.0",
Platform: "linux/amd64",
Username: username,
Password: password,
Timeout: 30 * time.Second,
InsecureSkipVerify: true,
},
Expand Down
Loading