Skip to content

Commit d31f1f4

Browse files
authored
cmd/swarm/swarm-smoke: update smoke tests to fit the new scheme for the k8s cluster (#18104)
1 parent 6b6c4d1 commit d31f1f4

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

cmd/swarm/swarm-smoke/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ func main() {
4545
app.Flags = []cli.Flag{
4646
cli.StringFlag{
4747
Name: "cluster-endpoint",
48-
Value: "testing",
49-
Usage: "cluster to point to (local, open or testing)",
48+
Value: "prod",
49+
Usage: "cluster to point to (prod or a given namespace)",
5050
Destination: &cluster,
5151
},
5252
cli.IntFlag{

cmd/swarm/swarm-smoke/upload_and_sync.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"bytes"
2121
"crypto/md5"
2222
crand "crypto/rand"
23+
"crypto/tls"
2324
"errors"
2425
"fmt"
2526
"io"
@@ -32,25 +33,21 @@ import (
3233
"time"
3334

3435
"github.com/ethereum/go-ethereum/log"
36+
colorable "github.com/mattn/go-colorable"
3537
"github.com/pborman/uuid"
3638

3739
cli "gopkg.in/urfave/cli.v1"
3840
)
3941

4042
func generateEndpoints(scheme string, cluster string, from int, to int) {
4143
if cluster == "prod" {
42-
cluster = ""
43-
} else if cluster == "local" {
4444
for port := from; port <= to; port++ {
45-
endpoints = append(endpoints, fmt.Sprintf("%s://localhost:%v", scheme, port))
45+
endpoints = append(endpoints, fmt.Sprintf("%s://%v.swarm-gateways.net", scheme, port))
4646
}
47-
return
4847
} else {
49-
cluster = cluster + "."
50-
}
51-
52-
for port := from; port <= to; port++ {
53-
endpoints = append(endpoints, fmt.Sprintf("%s://%v.%sswarm-gateways.net", scheme, port, cluster))
48+
for port := from; port <= to; port++ {
49+
endpoints = append(endpoints, fmt.Sprintf("%s://swarm-%v-%s.stg.swarm-gateways.net", scheme, port, cluster))
50+
}
5451
}
5552

5653
if includeLocalhost {
@@ -59,6 +56,9 @@ func generateEndpoints(scheme string, cluster string, from int, to int) {
5956
}
6057

6158
func cliUploadAndSync(c *cli.Context) error {
59+
log.PrintOrigins(true)
60+
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true))))
61+
6262
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
6363

6464
generateEndpoints(scheme, cluster, from, to)
@@ -112,7 +112,10 @@ func fetch(hash string, endpoint string, original []byte, ruid string) error {
112112
time.Sleep(3 * time.Second)
113113

114114
log.Trace("http get request", "ruid", ruid, "api", endpoint, "hash", hash)
115-
res, err := http.Get(endpoint + "/bzz:/" + hash + "/")
115+
client := &http.Client{Transport: &http.Transport{
116+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
117+
}}
118+
res, err := client.Get(endpoint + "/bzz:/" + hash + "/")
116119
if err != nil {
117120
log.Warn(err.Error(), "ruid", ruid)
118121
return err

0 commit comments

Comments
 (0)