Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
Fix target check failed for linker (#47)
Browse files Browse the repository at this point in the history
* Fix target check failed for linker

* Update target check
  • Loading branch information
JinnyYi authored Jul 28, 2021
1 parent a5d6fd8 commit 17203b5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions linker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tests
import (
"io"
"math/rand"
"path/filepath"
"testing"

"github.com/google/uuid"
Expand All @@ -17,6 +18,8 @@ func TestLinker(t *testing.T, store types.Storager) {
l, ok := store.(types.Linker)
So(ok, ShouldBeTrue)

workDir := store.Metadata().WorkDir

Convey("When create a link object", func() {
size := rand.Int63n(4 * 1024 * 1024) // Max file size is 4MB
r := io.LimitReader(randbytes.NewRand(), size)
Expand Down Expand Up @@ -58,7 +61,7 @@ func TestLinker(t *testing.T, store types.Storager) {
linkTarget, ok := o.GetLinkTarget()

So(ok, ShouldBeTrue)
So(linkTarget, ShouldEqual, target)
So(linkTarget, ShouldEqual, filepath.Join(workDir, target))
})

Convey("Stat should get path object without error", func() {
Expand All @@ -78,7 +81,7 @@ func TestLinker(t *testing.T, store types.Storager) {
linkTarget, ok := obj.GetLinkTarget()

So(ok, ShouldBeTrue)
So(linkTarget, ShouldEqual, target)
So(linkTarget, ShouldEqual, filepath.Join(workDir, target))
})
})
})
Expand Down Expand Up @@ -109,7 +112,7 @@ func TestLinker(t *testing.T, store types.Storager) {
linkTarget, ok := o.GetLinkTarget()

So(ok, ShouldBeTrue)
So(linkTarget, ShouldEqual, target)
So(linkTarget, ShouldEqual, filepath.Join(workDir, target))
})

Convey("Stat should get path object without error", func() {
Expand All @@ -129,7 +132,7 @@ func TestLinker(t *testing.T, store types.Storager) {
linkTarget, ok := obj.GetLinkTarget()

So(ok, ShouldBeTrue)
So(linkTarget, ShouldEqual, target)
So(linkTarget, ShouldEqual, filepath.Join(workDir, target))
})
})
})
Expand Down Expand Up @@ -197,7 +200,7 @@ func TestLinker(t *testing.T, store types.Storager) {
linkTarget, ok := o.GetLinkTarget()

So(ok, ShouldBeTrue)
So(linkTarget, ShouldEqual, secondTarget)
So(linkTarget, ShouldEqual, filepath.Join(workDir, secondTarget))
})
})
})
Expand Down

0 comments on commit 17203b5

Please sign in to comment.