Skip to content

Commit

Permalink
merge login to image module (#2121)
Browse files Browse the repository at this point in the history
  • Loading branch information
kakaZhou719 authored Mar 17, 2023
1 parent b964a4d commit adb56a9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 80 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/e2e-test-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

permissions:
statuses: write

jobs:
build:
name: test
Expand Down Expand Up @@ -84,17 +84,6 @@ jobs:
echo "$GOPATH/bin" >> $GITHUB_PATH
working-directory: src/github.com/sealerio/sealer

- name: Run sealer login test
shell: bash
working-directory: src/github.com/sealerio/sealer
env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
if: ${{ github.event.comment.body == '/test login' || github.event.comment.body == '/test all' || github.event_name == 'push' || github.event_name == 'pull_request_target' }}
run: |
ginkgo -v -focus="sealer login" -cover -covermode=atomic -coverpkg=./... -coverprofile=/tmp/coverage-login.out -trace test
- name: Run sealer image test and generate coverage
shell: bash
working-directory: src/github.com/sealerio/sealer
Expand All @@ -106,7 +95,7 @@ jobs:
if: ${{ github.event.comment.body == '/test image' || github.event.comment.body == '/test all' || github.event_name == 'push' || github.event_name == 'pull_request_target' }}
run: |
ginkgo -v -focus="sealer image" -cover -covermode=atomic -coverpkg=./... -coverprofile=/tmp/coverage-image.out -trace test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
43 changes: 42 additions & 1 deletion test/sealer_images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("sealer images module", func() {
var _ = Describe("sealer image", func() {
Context("pull image", func() {

It(fmt.Sprintf("pull image %s", settings.TestImageName), func() {
Expand Down Expand Up @@ -113,5 +113,46 @@ var _ = Describe("sealer images module", func() {
})
})

Context("login registry", func() {
AfterEach(func() {
registry.Logout()
})
It("with correct name and password", func() {
image.CheckLoginResult(
settings.RegistryURL,
settings.RegistryUsername,
settings.RegistryPasswd,
true)
})
It("with incorrect name and password", func() {
image.CheckLoginResult(
settings.RegistryURL,
settings.RegistryPasswd,
settings.RegistryUsername,
false)
})
It("with only name", func() {
image.CheckLoginResult(
settings.RegistryURL,
settings.RegistryUsername,
"",
false)
})
It("with only password", func() {
image.CheckLoginResult(
settings.RegistryURL,
"",
settings.RegistryPasswd,
false)
})
It("with only registryURL", func() {
image.CheckLoginResult(
settings.RegistryURL,
"",
"",
false)
})
})

//todo add mount and umount e2e test
})
66 changes: 0 additions & 66 deletions test/sealer_login_test.go

This file was deleted.

0 comments on commit adb56a9

Please sign in to comment.