Enable ipv6 tests (#1204)
This commit is contained in:
parent
fdbe2db273
commit
60b0275a44
@ -138,6 +138,9 @@ func newNetwork(flags *Flags) (*Processes, error) {
|
|||||||
},
|
},
|
||||||
"run": {},
|
"run": {},
|
||||||
})
|
})
|
||||||
|
bootstrap.ExecBefore["run"] = func(process *Process) error {
|
||||||
|
return readConfigString(&bootstrap.Address, bootstrap.Directory, "server.address")
|
||||||
|
}
|
||||||
|
|
||||||
// Create satellites making all satellites wait for bootstrap to start
|
// Create satellites making all satellites wait for bootstrap to start
|
||||||
var satellites []*Process
|
var satellites []*Process
|
||||||
@ -165,10 +168,15 @@ func newNetwork(flags *Flags) (*Processes, error) {
|
|||||||
},
|
},
|
||||||
"run": {},
|
"run": {},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
process.ExecBefore["run"] = func(process *Process) error {
|
||||||
|
return readConfigString(&process.Address, process.Directory, "server.address")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create gateways for each satellite
|
// Create gateways for each satellite
|
||||||
for i, satellite := range satellites {
|
for i, satellite := range satellites {
|
||||||
|
satellite := satellite
|
||||||
process := processes.New(Info{
|
process := processes.New(Info{
|
||||||
Name: fmt.Sprintf("gateway/%d", i),
|
Name: fmt.Sprintf("gateway/%d", i),
|
||||||
Executable: "gateway",
|
Executable: "gateway",
|
||||||
@ -199,6 +207,11 @@ func newNetwork(flags *Flags) (*Processes, error) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
process.ExecBefore["run"] = func(process *Process) error {
|
process.ExecBefore["run"] = func(process *Process) error {
|
||||||
|
err := readConfigString(&process.Address, process.Directory, "server.address")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
vip := viper.New()
|
vip := viper.New()
|
||||||
vip.AddConfigPath(process.Directory)
|
vip.AddConfigPath(process.Directory)
|
||||||
if err := vip.ReadInConfig(); err != nil {
|
if err := vip.ReadInConfig(); err != nil {
|
||||||
@ -212,14 +225,18 @@ func newNetwork(flags *Flags) (*Processes, error) {
|
|||||||
// so that gateway can have access to the satellite
|
// so that gateway can have access to the satellite
|
||||||
apiKey := vip.GetString("client.api-key")
|
apiKey := vip.GetString("client.api-key")
|
||||||
if apiKey == "" {
|
if apiKey == "" {
|
||||||
consoleAddress := fmt.Sprintf(
|
var consoleAddress string
|
||||||
"http://%s/api/graphql/v0",
|
satelliteConfigErr := readConfigString(&consoleAddress, satellite.Directory, "console.address")
|
||||||
net.JoinHostPort(host, strconv.Itoa(consolePort+i)))
|
if satelliteConfigErr != nil {
|
||||||
|
return satelliteConfigErr
|
||||||
|
}
|
||||||
|
|
||||||
|
consoleAPIAddress := "http://" + consoleAddress + "/api/graphql/v0"
|
||||||
|
|
||||||
// wait for console server to start
|
// wait for console server to start
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
|
|
||||||
if err := addExampleProjectWithKey(&apiKey, consoleAddress); err != nil {
|
if err := addExampleProjectWithKey(&apiKey, consoleAPIAddress); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +282,10 @@ func newNetwork(flags *Flags) (*Processes, error) {
|
|||||||
},
|
},
|
||||||
"run": {},
|
"run": {},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
process.ExecBefore["run"] = func(process *Process) error {
|
||||||
|
return readConfigString(&process.Address, process.Directory, "server.address")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // verify that we have all binaries
|
{ // verify that we have all binaries
|
||||||
@ -325,3 +346,16 @@ func identitySetup(network *Processes) (*Processes, error) {
|
|||||||
|
|
||||||
return processes, nil
|
return processes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// readConfigString reads from dir/config.yaml flagName returns the value in `into`
|
||||||
|
func readConfigString(into *string, dir, flagName string) error {
|
||||||
|
vip := viper.New()
|
||||||
|
vip.AddConfigPath(dir)
|
||||||
|
if err := vip.ReadInConfig(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if v := vip.GetString(flagName); v != "" {
|
||||||
|
*into = v
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -ueo pipefail
|
set -ueo pipefail
|
||||||
|
set +x
|
||||||
|
|
||||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ cleanup(){
|
|||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
export STORJ_LOCAL_NETWORK=$TMP
|
export STORJ_NETWORK_DIR=$TMP
|
||||||
|
|
||||||
# setup the network
|
# setup the network
|
||||||
storj-sim -x network setup
|
storj-sim -x network setup
|
||||||
@ -21,9 +22,10 @@ storj-sim -x network setup
|
|||||||
storj-sim -x network test bash $SCRIPTDIR/test-sim-aws.sh
|
storj-sim -x network test bash $SCRIPTDIR/test-sim-aws.sh
|
||||||
storj-sim -x network destroy
|
storj-sim -x network destroy
|
||||||
|
|
||||||
# ipv6 tests disabled because aws-cli doesn't seem to support connecting to ipv6 host
|
# setup the network with ipv6
|
||||||
# # setup the network with ipv6
|
storj-sim -x --host "::1" network setup
|
||||||
# storj-sim -x --host "::1" network setup
|
# aws-cli doesn't support gateway with ipv6 address, so change it to use localhost
|
||||||
# # run aws-cli tests using ipv6
|
find $STORJ_NETWORK_DIR/gateway -type f -name config.yaml -exec sed -i "s/server.address: \"\[::1\]/server.address: \"127.0.0.1/" {} +
|
||||||
# storj-sim -x --host "::1" network test bash $SCRIPTDIR/test-storj-sim-aws.sh
|
# run aws-cli tests using ipv6
|
||||||
# storj-sim -x network destroy
|
storj-sim -x --host "::1" network test bash $SCRIPTDIR/test-sim-aws.sh
|
||||||
|
storj-sim -x network destroy
|
Loading…
Reference in New Issue
Block a user