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

test: Implement GSP-86 Add linker integration tests #40

Merged
merged 11 commits into from
Jul 27, 2021

Conversation

abyss-w
Copy link
Contributor

@abyss-w abyss-w commented Jul 21, 2021

test: Implement GSP-86 Add linker integration tests

linker.go Outdated Show resolved Hide resolved
linker.go Outdated Show resolved Hide resolved
linker.go Outdated Show resolved Hide resolved
linker.go Outdated Show resolved Hide resolved
linker.go Outdated Show resolved Hide resolved
linker.go Outdated Show resolved Hide resolved
go.mod Outdated
@@ -3,7 +3,7 @@ module github.com/beyondstorage/go-integration-test/v4
go 1.15

require (
github.com/beyondstorage/go-storage/v4 v4.3.2
github.com/beyondstorage/go-storage/v4 v4.3.3-0.20210720033749-df6a96af6045
Copy link
Contributor

@Xuanwo Xuanwo Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @JinnyYi, Let's solve beyondstorage/go-storage#682 so that we can use it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go-storage v4.4.0 have been released.

@JinnyYi
Copy link
Contributor

JinnyYi commented Jul 22, 2021

I made some mistakes and tested symlink based on files in fs and objects in oss:

  • When target is exist and path is not exist:

    • Both fs and oss can create symlink successfully and the returned symlink is readable.
  • When target is not exist and path is not exist:

    • Both fs and oss can create symlink successfully.
    • The target can be get from the symlink.
    • After we write to target(the target file or object), we can get the content from the symlink.
  • When target is exist and path is also exist:

    • For oss, PutSymlink will succeed no mater path identifies an object or a symlink, like overwrite.
    • For fs, os.Symlink will get error no mater path identifies a file, a directory or a symlink.
  • For oss, the Symlink object type can be get from ListObject, but seems can't get form GetMetadata.

  • For fs, maybe we should check and delete the path if it is exist as describe in GSP-134: Write Behavior Consistency.

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 23, 2021

Nice catch, maybe we need to add them in specs or update the rfc.

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 26, 2021

Linker should also take #42 a look.

linker.go Outdated
})
}

func TestLinkerWithVirtualLink(t *testing.T, store types.Storager) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function will be called by services that support overwrite, like oss. But actually symlink is native support for oss. So maybe the function name TestLinkerWithVirtualLink is not suitable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using TestLinkerWithoutOverwrite and TestLinkerWithOverWrite as function names?

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 27, 2021

This PR lives so long.

How about removing the parts we haven't agreed on yet and merge TestLinker into master first?

We can specify the corner case behavior later.

@abyss-w
Copy link
Contributor Author

abyss-w commented Jul 27, 2021

How about removing the parts we haven't agreed on yet and merge TestLinker into master first?

OK

linker.go Outdated

Convey("Read should get path object data without error", func() {
var buf bytes.Buffer
n, err := store.Read(path, &buf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinkObject is not readable, so we can't read from a link directly. Instead, we need to read from the link object's LinkTarget.

Maybe we can remove tests about Read should get path object data without error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 27, 2021

@abyss-w Hi, we will squash all commits while merging, so don't bother to do a force push here.

@abyss-w
Copy link
Contributor Author

abyss-w commented Jul 27, 2021

@abyss-w Hi, we will squash all commits while merging, so don't bother to do a force push here.

ok, got it.

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 27, 2021

ping @JinnyYi to take another look.

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 27, 2021

Thank you for your patient and detailed work!

@Xuanwo Xuanwo merged commit a5d6fd8 into beyondstorage:master Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants