forked from TrueCloudLab/frostfs-http-gw
[#212] Support CORS container for CORS settings
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
This commit is contained in:
parent
9cf2a4f0e0
commit
9ef6b06e91
18 changed files with 1204 additions and 203 deletions
|
@ -43,9 +43,10 @@ type putResponse struct {
|
|||
}
|
||||
|
||||
const (
|
||||
testContainerName = "friendly"
|
||||
testListenAddress = "localhost:8082"
|
||||
testHost = "http://" + testListenAddress
|
||||
testContainerName = "friendly"
|
||||
testListenAddress = "localhost:8082"
|
||||
testHost = "http://" + testListenAddress
|
||||
testCORSContainerName = "cors"
|
||||
)
|
||||
|
||||
func TestIntegration(t *testing.T) {
|
||||
|
@ -76,10 +77,14 @@ func TestIntegration(t *testing.T) {
|
|||
registerUser(t, ctx, aioContainer, file.Name())
|
||||
}
|
||||
|
||||
// Creating CORS container
|
||||
clientPool := getPool(ctx, t, key)
|
||||
_, err = createContainer(ctx, t, clientPool, ownerID, testCORSContainerName)
|
||||
require.NoError(t, err, version)
|
||||
|
||||
// See the logs from the command execution.
|
||||
server, cancel := runServer(file.Name())
|
||||
clientPool := getPool(ctx, t, key)
|
||||
CID, err := createContainer(ctx, t, clientPool, ownerID)
|
||||
CID, err := createContainer(ctx, t, clientPool, ownerID, testContainerName)
|
||||
require.NoError(t, err, version)
|
||||
|
||||
jsonToken, binaryToken := makeBearerTokens(t, key, ownerID, version)
|
||||
|
@ -110,6 +115,8 @@ func runServer(pathToWallet string) (App, context.CancelFunc) {
|
|||
v.config().Set(cfgWalletPath, pathToWallet)
|
||||
v.config().Set(cfgWalletPassphrase, "")
|
||||
|
||||
v.config().Set(cfgContainersCORS, testCORSContainerName+"."+containerv2.SysAttributeZoneDefault)
|
||||
|
||||
application := newApp(cancelCtx, v)
|
||||
go application.Serve()
|
||||
|
||||
|
@ -477,7 +484,7 @@ func getPool(ctx context.Context, t *testing.T, key *keys.PrivateKey) *pool.Pool
|
|||
return clientPool
|
||||
}
|
||||
|
||||
func createContainer(ctx context.Context, t *testing.T, clientPool *pool.Pool, ownerID user.ID) (cid.ID, error) {
|
||||
func createContainer(ctx context.Context, t *testing.T, clientPool *pool.Pool, ownerID user.ID, name string) (cid.ID, error) {
|
||||
var policy netmap.PlacementPolicy
|
||||
err := policy.DecodeString("REP 1")
|
||||
require.NoError(t, err)
|
||||
|
@ -491,7 +498,7 @@ func createContainer(ctx context.Context, t *testing.T, clientPool *pool.Pool, o
|
|||
container.SetCreationTime(&cnr, time.Now())
|
||||
|
||||
var domain container.Domain
|
||||
domain.SetName(testContainerName)
|
||||
domain.SetName(name)
|
||||
|
||||
cnr.SetAttribute(containerv2.SysAttributeName, domain.Name())
|
||||
cnr.SetAttribute(containerv2.SysAttributeZone, domain.Zone())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue