[#1] Use FrostFS AIO image in integration test

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
Alexey Vanin 2023-05-16 17:35:58 +03:00
parent 168b67dc31
commit 048c626750

View file

@ -37,21 +37,16 @@ type putResponse struct {
} }
const ( const (
testContainerName = "friendly" testContainerName = "friendly"
versionWithNativeNames = "0.27.5" testListenAddress = "localhost:8082"
testListenAddress = "localhost:8082" testHost = "http://" + testListenAddress
testHost = "http://" + testListenAddress
) )
func TestIntegration(t *testing.T) { func TestIntegration(t *testing.T) {
rootCtx := context.Background() rootCtx := context.Background()
aioImage := "nspccdev/neofs-aio-testcontainer:" aioImage := "truecloudlab/frostfs-aio:"
versions := []string{ versions := []string{
"0.29.0", "1.2.5", // frostfs-storage v0.36.0 RC
"0.30.0",
"0.32.0",
"0.34.0",
"latest",
} }
key, err := keys.NewPrivateKeyFromHex("1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb") key, err := keys.NewPrivateKeyFromHex("1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb")
require.NoError(t, err) require.NoError(t, err)
@ -97,10 +92,8 @@ func simplePut(ctx context.Context, t *testing.T, p *pool.Pool, CID cid.ID, vers
url := testHost + "/upload/" + CID.String() url := testHost + "/upload/" + CID.String()
makePutRequestAndCheck(ctx, t, p, CID, url) makePutRequestAndCheck(ctx, t, p, CID, url)
if version >= versionWithNativeNames { url = testHost + "/upload/" + testContainerName
url = testHost + "/upload/" + testContainerName makePutRequestAndCheck(ctx, t, p, CID, url)
makePutRequestAndCheck(ctx, t, p, CID, url)
}
} }
func makePutRequestAndCheck(ctx context.Context, t *testing.T, p *pool.Pool, cnrID cid.ID, url string) { func makePutRequestAndCheck(ctx context.Context, t *testing.T, p *pool.Pool, cnrID cid.ID, url string) {
@ -223,11 +216,9 @@ func simpleGet(ctx context.Context, t *testing.T, clientPool *pool.Pool, ownerID
require.NoError(t, err) require.NoError(t, err)
checkGetResponse(t, resp, content, attributes) checkGetResponse(t, resp, content, attributes)
if version >= versionWithNativeNames { resp, err = http.Get(testHost + "/get/" + testContainerName + "/" + id.String())
resp, err = http.Get(testHost + "/get/" + testContainerName + "/" + id.String()) require.NoError(t, err)
require.NoError(t, err) checkGetResponse(t, resp, content, attributes)
checkGetResponse(t, resp, content, attributes)
}
} }
func checkGetResponse(t *testing.T, resp *http.Response, content string, attributes map[string]string) { func checkGetResponse(t *testing.T, resp *http.Response, content string, attributes map[string]string) {
@ -277,11 +268,9 @@ func getByAttr(ctx context.Context, t *testing.T, clientPool *pool.Pool, ownerID
require.NoError(t, err) require.NoError(t, err)
checkGetByAttrResponse(t, resp, content, expectedAttr) checkGetByAttrResponse(t, resp, content, expectedAttr)
if version >= versionWithNativeNames { resp, err = http.Get(testHost + "/get_by_attribute/" + testContainerName + "/" + keyAttr + "/" + valAttr)
resp, err = http.Get(testHost + "/get_by_attribute/" + testContainerName + "/" + keyAttr + "/" + valAttr) require.NoError(t, err)
require.NoError(t, err) checkGetByAttrResponse(t, resp, content, expectedAttr)
checkGetByAttrResponse(t, resp, content, expectedAttr)
}
} }
func getZip(ctx context.Context, t *testing.T, clientPool *pool.Pool, ownerID user.ID, CID cid.ID, version string) { func getZip(ctx context.Context, t *testing.T, clientPool *pool.Pool, ownerID user.ID, CID cid.ID, version string) {
@ -296,10 +285,8 @@ func getZip(ctx context.Context, t *testing.T, clientPool *pool.Pool, ownerID us
baseURL := testHost + "/zip/" + CID.String() baseURL := testHost + "/zip/" + CID.String()
makeZipTest(t, baseURL, names, contents) makeZipTest(t, baseURL, names, contents)
if version >= versionWithNativeNames { baseURL = testHost + "/zip/" + testContainerName
baseURL = testHost + "/zip/" + testContainerName makeZipTest(t, baseURL, names, contents)
makeZipTest(t, baseURL, names, contents)
}
} }
func makeZipTest(t *testing.T, baseURL string, names, contents []string) { func makeZipTest(t *testing.T, baseURL string, names, contents []string) {
@ -407,15 +394,11 @@ func createContainer(ctx context.Context, t *testing.T, clientPool *pool.Pool, o
container.SetCreationTime(&cnr, time.Now()) container.SetCreationTime(&cnr, time.Now())
if version >= versionWithNativeNames { var domain container.Domain
var domain container.Domain domain.SetName(testContainerName)
domain.SetName(testContainerName)
// currently node in aio image knows nothing about new sys attributes cnr.SetAttribute(containerv2.SysAttributeName, domain.Name())
// todo (@dkirillov): #2 use frostfs aio images that supports new attributes cnr.SetAttribute(containerv2.SysAttributeZone, domain.Zone())
cnr.SetAttribute(containerv2.SysAttributeNameNeoFS, domain.Name())
cnr.SetAttribute(containerv2.SysAttributeZoneNeoFS, domain.Zone())
}
var waitPrm pool.WaitParams var waitPrm pool.WaitParams
waitPrm.SetTimeout(15 * time.Second) waitPrm.SetTimeout(15 * time.Second)