Merge pull request #1256 from cuisongliu/test

refactor(main): add test workflows
This commit is contained in:
zzjin
2022-07-05 23:14:48 +08:00
committed by GitHub
3 changed files with 20 additions and 20 deletions
+20
View File
@@ -0,0 +1,20 @@
name: CI
on: [push, pull_request]
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Install libgpg-dev
run: sudo apt-get install -y libgpgme-dev libdevmapper-dev
- uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Run coverage
run: go test -race -coverprofile=coverage.out -covermode=atomic `go list ./pkg/env | grep -v /test`
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
-19
View File
@@ -15,32 +15,13 @@
package registry
import (
"context"
"reflect"
"testing"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/distribution/distribution/v3/configuration"
"github.com/docker/docker/api/types"
)
func TestSaveImages(t *testing.T) {
//tests := []string{"quay.io/tigera/operator:v1.25.3"}
tests := []string{"47.94.15.171:5000/11c-code/11c-image-hook:0bb9121b"}
is := NewImageSaver(context.Background(), 5, map[string]types.AuthConfig{
"47.94.15.171:5000": {
Username: "admin",
Password: "passw0rd",
},
}, true)
images, err := is.SaveImages(tests, "/Users/cuisongliu/DockerImages/registry", v1.Platform{OS: "linux", Architecture: "amd64"})
if err != nil {
t.Error(err)
}
t.Logf("%+v", images)
}
func Test_splitDockerDomain(t *testing.T) {
tests := []struct {
name string
-1
View File
@@ -20,6 +20,5 @@ import (
func TestConn(t *testing.T) {
log := NewLogger()
log.SetLogger("conn", `{"net":"tcp","addr":"10.1.55.10:1024"}`)
log.Info("this is informational to net")
}