Skip to content

Commit 63b37f3

Browse files
committed
feat: add async propagation
1 parent 985d7ef commit 63b37f3

File tree

9 files changed

+165
-355
lines changed

9 files changed

+165
-355
lines changed

Diff for: .drone.star

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def tests(ctx):
131131
},
132132
{
133133
"name": "test",
134-
"image": "owncloudci/golang:1.21",
134+
"image": "owncloudci/golang:1.22",
135135
"commands": [
136136
"go test --endpoint=ocis:9142 -v",
137137
],
@@ -197,7 +197,7 @@ def dockerRelease(ctx, arch):
197197
"steps": [
198198
{
199199
"name": "build",
200-
"image": "owncloudci/golang:1.21",
200+
"image": "owncloudci/golang:1.22",
201201
"commands": [
202202
"go test -c -o cs3api-validator-linux-%s.test" % (arch),
203203
],

Diff for: cs3apivalidator_test.go

+9-13
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ package main
33
import (
44
"os"
55
"testing"
6+
"time"
67

78
"github.com/cucumber/godog"
89
"github.com/cucumber/godog/colors"
10+
"github.com/owncloud/cs3api-validator/featurecontext"
911
"github.com/owncloud/cs3api-validator/scenario"
1012
flag "github.com/spf13/pflag"
1113
)
@@ -15,29 +17,23 @@ var opts = godog.Options{
1517
Format: "pretty", // can define default values
1618
}
1719

18-
// endpoint GRPC address of a running CS3 implementation
19-
var endpoint string
20-
21-
// httpInsecure controls whether insecure HTTP connections are allowed or not
22-
var httpInsecure bool
23-
24-
// grpcTLSMode TLS mode for grpc client connections
25-
var grpcTLSMode string
26-
2720
func init() {
2821
godog.BindCommandLineFlags("godog.", &opts)
2922
}
3023

3124
func TestMain(m *testing.M) {
32-
flag.StringVar(&endpoint, "endpoint", "localhost:9142", "Endpoint Url and port of a running cs3 implementation")
33-
flag.StringVar(&grpcTLSMode, "grpc-tls-mode", "off", "TLS mode for grpc client connections ('off', 'on' or 'insecure')")
34-
flag.BoolVar(&httpInsecure, "http-insecure", true, "Allow insecure HTTP connections")
25+
cfg := featurecontext.Config{}
26+
flag.StringVar(&cfg.Endpoint, "endpoint", "localhost:9142", "Endpoint Url and port of a running cs3 implementation")
27+
flag.StringVar(&cfg.GrpcTLSMode, "grpc-tls-mode", "off", "TLS mode for grpc client connections ('off', 'on' or 'insecure')")
28+
flag.BoolVar(&cfg.AsyncPropagation, "async-propagation", false, "Enable async propagation")
29+
flag.DurationVar(&cfg.AsyncPropagationDelay, "async-propagation-delay", 200*time.Millisecond, "Delay for async propagation")
30+
flag.BoolVar(&cfg.HttpInsecure, "http-insecure", true, "Allow insecure HTTP connections")
3531
flag.Parse()
3632
opts.Paths = flag.Args()
3733

3834
status := godog.TestSuite{
3935
Name: "cs3apiValidator",
40-
ScenarioInitializer: scenario.InitializeScenario(endpoint, httpInsecure, grpcTLSMode),
36+
ScenarioInitializer: scenario.InitializeScenario(cfg),
4137
Options: &opts,
4238
}.Run()
4339

Diff for: featurecontext/featurecontext.go

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package featurecontext
22

33
import (
44
"net/http"
5+
"time"
56

67
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
78
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
@@ -19,10 +20,19 @@ type ResourceAlias struct {
1920
Info *providerv1beta1.ResourceInfo
2021
}
2122

23+
type Config struct {
24+
Endpoint string
25+
HttpInsecure bool
26+
GrpcTLSMode string
27+
AsyncPropagation bool
28+
AsyncPropagationDelay time.Duration
29+
}
30+
2231
// FeatureContext holds values which are used across test steps
2332
type FeatureContext struct {
2433
Client gateway.GatewayAPIClient
2534
HTTPClient http.Client
35+
Config Config
2636

2737
// remember the last response to check the outcome
2838
Response interface{}

Diff for: featurecontext/init.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import (
1212
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
1313
)
1414

15-
func (f *FeatureContext) Init(endpoint string, httpInsecure bool, grpcTLSMode string) {
15+
func (f *FeatureContext) Init(cfg Config) {
16+
f.Config = cfg
1617
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
17-
tm, err := pool.StringToTLSMode(grpcTLSMode)
18+
tm, err := pool.StringToTLSMode(cfg.GrpcTLSMode)
1819
if err != nil {
1920
log.Fatal().Msg("Could not set TLS mode for grpc client")
2021
}
21-
client, err := pool.GetGatewayServiceClient(endpoint, pool.WithTLSMode(tm))
22+
client, err := pool.GetGatewayServiceClient(cfg.Endpoint, pool.WithTLSMode(tm))
2223
if err != nil {
2324
log.Fatal().Msg("Could not initialize a grpc client")
2425
}
@@ -27,7 +28,7 @@ func (f *FeatureContext) Init(endpoint string, httpInsecure bool, grpcTLSMode st
2728
f.HTTPClient = http.Client{
2829
Transport: &http.Transport{
2930
TLSClientConfig: &tls.Config{
30-
InsecureSkipVerify: httpInsecure,
31+
InsecureSkipVerify: cfg.HttpInsecure,
3132
},
3233
},
3334
Timeout: time.Second * 10,

Diff for: go.mod

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
module github.com/owncloud/cs3api-validator
22

3-
go 1.18
3+
go 1.22.7
44

55
require (
66
github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965
77
github.com/cs3org/reva/v2 v2.10.1-0.20221019091055-df0a189e218d
8-
github.com/cucumber/godog v0.12.2
9-
github.com/cucumber/messages-go/v16 v16.0.1
8+
github.com/cucumber/godog v0.15.0
9+
github.com/cucumber/messages/go/v21 v21.0.1
1010
github.com/rs/zerolog v1.28.0
1111
github.com/spf13/pflag v1.0.5
12-
github.com/stretchr/testify v1.8.0
13-
google.golang.org/grpc v1.49.0
12+
github.com/stretchr/testify v1.8.2
13+
google.golang.org/grpc v1.68.0
1414
)
1515

1616
require (
1717
cloud.google.com/go/compute v1.10.0 // indirect
1818
github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e // indirect
1919
github.com/bluele/gcache v0.0.2 // indirect
20-
github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
20+
github.com/cucumber/gherkin/go/v26 v26.2.0 // indirect
2121
github.com/davecgh/go-spew v1.1.1 // indirect
2222
github.com/fatih/color v1.13.0 // indirect
2323
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
2424
github.com/go-ldap/ldap/v3 v3.4.4 // indirect
2525
github.com/go-logr/logr v1.2.3 // indirect
2626
github.com/go-logr/stdr v1.2.2 // indirect
27-
github.com/gofrs/uuid v4.3.0+incompatible // indirect
27+
github.com/gofrs/uuid v4.3.1+incompatible // indirect
2828
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
29-
github.com/golang/protobuf v1.5.2 // indirect
30-
github.com/google/uuid v1.3.0 // indirect
29+
github.com/golang/protobuf v1.5.4 // indirect
30+
github.com/google/uuid v1.6.0 // indirect
3131
github.com/hashicorp/go-hclog v1.3.1 // indirect
3232
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
33-
github.com/hashicorp/go-memdb v1.3.0 // indirect
33+
github.com/hashicorp/go-memdb v1.3.4 // indirect
3434
github.com/hashicorp/go-plugin v1.4.4 // indirect
3535
github.com/hashicorp/golang-lru v0.5.4 // indirect
3636
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
@@ -49,12 +49,11 @@ require (
4949
go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
5050
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
5151
go.opentelemetry.io/otel/trace v1.10.0 // indirect
52-
golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0 // indirect
53-
golang.org/x/net v0.0.0-20220921155015-db77216a4ee9 // indirect
54-
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
55-
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
56-
golang.org/x/text v0.3.7 // indirect
52+
golang.org/x/crypto v0.27.0 // indirect
53+
golang.org/x/net v0.29.0 // indirect
54+
golang.org/x/sys v0.25.0 // indirect
55+
golang.org/x/text v0.18.0 // indirect
5756
google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006 // indirect
58-
google.golang.org/protobuf v1.28.1 // indirect
57+
google.golang.org/protobuf v1.34.2 // indirect
5958
gopkg.in/yaml.v3 v3.0.1 // indirect
6059
)

0 commit comments

Comments
 (0)