ncw/swift

Go tests fail on v2.0 endpoint

namsral opened this issue · 11 comments

As requested I opened an issue because the Go tests fail on my OpenStack Mitaka backend with v2.0 authentication.

restic/restic#1039 (comment)

~/src/github.com/ncw/swift$ source openrc.sh
~/src/github.com/ncw/swift$ export SWIFT_TENANT_ID=$OS_TENANT_ID
~/src/github.com/ncw/swift$ export SWIFT_API_KEY=$OS_PASSWORD
~/src/github.com/ncw/swift$ export SWIFT_AUTH_URL=$OS_AUTH_URL
~/src/github.com/ncw/swift$ export SWIFT_TENANT=$OS_TENANT
~/src/github.com/ncw/swift$ export SWIFT_API_USER=$OS_USERNAME
~/src/github.com/ncw/swift$ go version
go version go1.8.3 linux/amd64
~/src/github.com/ncw/swift$ go test
Waiting for server to start . Started
--- FAIL: TestAuthenticateRace (1.10s)
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
	swift_test.go:456: Auth failed Response didn't have storage url and auth token
--- FAIL: TestSerializeConnectionJson (0.11s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestSerializeConnectionXml (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestOnReAuth (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestAccount (0.11s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestAccountUpdate (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainerCreate (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainer (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainersAll (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainersAllWithLimit (0.09s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainerUpdate (0.09s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainerNames (0.09s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainerNamesAll (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestContainerNamesAllWithLimit (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectPutString (0.11s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectPut (0.11s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectEmpty (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectPutBytes (0.11s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectPutMimeType (0.11s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectCreate (0.13s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectGetString (0.09s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectGetBytes (0.10s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
--- FAIL: TestObjectOpen (0.11s)
	swift_test.go:134: Auth failed Response didn't have storage url and auth token
^Csignal: interrupt
FAIL	github.com/ncw/swift	4.409s
ncw commented

Hmm, that never authenticated which wasn't really a good test!

I normally set these 4 variables only with a v2 auth server. Are you sure you are using v2 auth? does the URL have a v2 in it? I thought Mitaka was now using v3 auth by default?

export SWIFT_TENANT=XXX
export SWIFT_API_USER=XXX
export SWIFT_API_KEY=XXX
export SWIFT_AUTH_URL=XXX
fd0 commented

What's the correct variable name? SWIFT_TENANT_ID or SWIFT_TENANT?

ncw commented

They do different things. It should work with SWIFT_TENANT alone which is your tenant/project name

I'm using the v2.0 identity endpoint on Mitaka. Unsetting SWIFT_TENANT_ID makes no difference.

Have you tested this swift library with v2.0 identity endpoint in production?

fd0 commented

Huh, did you close this issue by accident?

ncw commented

Oops, closed by accident!

The swift library has been tested with v1, V2, V3 auth. Swift auth has changed over the years so it is quite complicated and rather annoying.

It clearly does work since you had it working with restic. Which parameters did you put into rclone?

The same parameters I used to test the swift library, sourced from the openrc file I downloaded from my Horizon dashboard.

OS_USERNAME
OS_PASSWORD
OS_AUTH_URL
OS_TENANT
OS_TENANT_ID

Using these parameters with rclone v1.36 I successfully created a container and uploaded some files.

ncw commented

I have fixed the integration tests with v2 auth - sorry about that.

If you try again with your original set of credentials they should work now hopefuly.

ncw commented

Which version of Ceph are you using? I've tried the integration tests against Openstack Liberty + Ceph Icehouse and they are working fine there.

Integration tests are now passing, 9e6fdb8 fixed it.

I don't have the Ceph version at hand, but I will next week.

ncw commented

@namsral thanks for testing that. So no errors reported by the integration tests is good, but doesn't help with restic/restic#1039 alas.

I'll close this issue for now.