Skip to content

Commit

Permalink
Merge branch 'master' into release-1.12-pubsub-rabbitmq-init-error
Browse files Browse the repository at this point in the history
Signed-off-by: Josh van Leeuwen <[email protected]>
  • Loading branch information
JoshVanL authored Oct 27, 2023
2 parents 8efc1a1 + 896679e commit 0af7225
Show file tree
Hide file tree
Showing 77 changed files with 4,318 additions and 3,488 deletions.
4 changes: 2 additions & 2 deletions .build-tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/invopop/jsonschema v0.6.0
github.com/spf13/cobra v1.6.1
github.com/xeipuuv/gojsonschema v1.2.1-0.20201027075954-b076d39a02e5
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
gopkg.in/yaml.v3 v3.0.1
sigs.k8s.io/yaml v1.3.0
)
Expand All @@ -24,7 +24,7 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apimachinery v0.26.3 // indirect
k8s.io/apimachinery v0.26.9 // indirect
)

replace github.com/dapr/components-contrib => ../
8 changes: 4 additions & 4 deletions .build-tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
Expand Down Expand Up @@ -80,7 +80,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k=
k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I=
k8s.io/apimachinery v0.26.9 h1:5yAV9cFR7Z4gIorKcAjWnx4uxtxiFsERwq4Pvmx0CCg=
k8s.io/apimachinery v0.26.9/go.mod h1:qYzLkrQ9lhrZRh0jNKo2cfvf/R1/kQONnSiyB7NUJU0=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
28 changes: 27 additions & 1 deletion .build-tools/pkg/metadataschema/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,32 @@ func (c *ComponentMetadata) AppendBuiltin() error {
},
)
}
if slices.Contains(c.Capabilities, "transactional") {
c.Metadata = append(c.Metadata,
Metadata{
Name: "outboxPublishPubsub",
Type: "string",
Description: "For outbox. Sets the name of the pub/sub component to deliver the notifications when publishing state changes",
},
Metadata{
Name: "outboxPublishTopic",
Type: "string",
Description: `For outbox. Sets the topic that receives the state changes on the pub/sub configured with "outboxPublishPubsub". The message body will be a state transaction item for an insert or update operation`,
},
Metadata{
Name: "outboxPubsub",
Type: "string",
Description: `For outbox. Sets the pub/sub component used by Dapr to coordinate the state and pub/sub transactions. If not set, the pub/sub component configured with "outboxPublishPubsub" is used. This is useful if you want to separate the pub/sub component used to send the notification state changes from the one used to coordinate the transaction`,
Default: "outboxPublishPubsub",
},
Metadata{
Name: "outboxDiscardWhenMissingState",
Description: "By setting outboxDiscardWhenMissingState to true, Dapr discards the transaction if it cannot find the state in the database and does not retry. This setting can be useful if the state store data has been deleted for any reason before Dapr was able to deliver the message and you would like Dapr to drop the items from the pub/sub and stop retrying to fetch the state",
Type: "bool",
Default: "false",
},
)
}

c.Metadata = append(c.Metadata,
Metadata{
Expand Down Expand Up @@ -233,7 +259,7 @@ func (c *ComponentMetadata) AppendBuiltin() error {
Example: `"/custom-path"`,
URL: &URL{
Title: "Documentation",
URL: "https://docs.dapr.io/developing-applications/building-blocks/bindings/howto-triggers/#specifying-a-custom-route",
URL: "https://docs.dapr.io/developing-applications/building-blocks/bindings/howto-triggers/#specify-a-custom-route",
},
},
)
Expand Down
6 changes: 6 additions & 0 deletions .github/holopin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
organization: dapr
defaultSticker: clmjkxscc122740fl0mkmb7egi
stickers:
-
id: clmjkxscc122740fl0mkmb7egi
alias: ghc2023
7 changes: 0 additions & 7 deletions .github/infrastructure/docker-compose-natsstreaming.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ Before this module can be used on a project, you must ensure that the following
$ terraform init

$ terraform refresh -var="gh_repo=dapr/components-contrib" \
-var="project_id=dapr-tests" -var="service_account=comp-contrib-wif" \
-var="wif_pool_name=contrib-cert-tests"
-var="project_id=dapr-tests" -var="service_account=dapr-contrib-wif-sa" \
-var="wif_pool_name=dapr-contrib-cert-tests"

$ terraform plan -var="gh_repo=dapr/components-contrib" \
-var="project_id=dapr-tests" -var="service_account=comp-contrib-wif" \
-var="wif_pool_name=contrib-cert-tests"
-var="project_id=dapr-tests" -var="service_account=dapr-contrib-wif-sa" \
-var="wif_pool_name=dapr-contrib-cert-tests"

$ terraform apply --auto-approve -var="gh_repo=dapr/components-contrib" \
-var="project_id=dapr-tests" -var="service_account=comp-contrib-wif" \
-var="wif_pool_name=contrib-cert-tests"
-var="project_id=dapr-tests" -var="service_account=dapr-contrib-wif-sa" \
-var="wif_pool_name=dapr-contrib-cert-tests"
```
Expand All @@ -72,7 +72,7 @@ $ terraform apply --auto-approve -var="gh_repo=dapr/components-contrib" \
```
$ terraform output

pool_name = "projects/***/locations/global/workloadIdentityPools/contrib-cert-tests-gh-pool"
provider_name = "projects/***/locations/global/workloadIdentityPools/contrib-cert-tests-gh-pool/providers/contrib-cert-tests-gh-provider"
pool_name = "projects/***/locations/global/workloadIdentityPools/dapr-contrib-cert-tests-pool"
provider_name = "projects/***/locations/global/workloadIdentityPools/dapr-contrib-cert-tests-pool/providers/dapr-contrib-cert-tests-provider"
sa_email = "***"
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module "oidc" {
source = "terraform-google-modules/github-actions-runners/google//modules/gh-oidc"
version = "~> 3.1.1"
project_id = var.project_id
pool_id = "${var.wif_pool_name}-gh-pool"
provider_id = "${var.wif_pool_name}-gh-provider"
pool_id = "${var.wif_pool_name}-pool"
provider_id = "${var.wif_pool_name}-provider"
sa_mapping = {
(google_service_account.sa.account_id) = {
sa_name = google_service_account.sa.name
Expand Down
4 changes: 0 additions & 4 deletions .github/scripts/test-info.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,6 @@ const components = {
conformanceSetup: 'docker-compose.sh vernemq',
sourcePkg: ['pubsub/mqtt3'],
},
'pubsub.natsstreaming': {
conformance: true,
conformanceSetup: 'docker-compose.sh natsstreaming',
},
'pubsub.pulsar': {
conformance: true,
certification: true,
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ run:
# list of build tags, all linters use it. Default is empty list.
build-tags:
- certtests
- conftests
- metadata

# which dirs to skip: they won't be analyzed;
Expand Down Expand Up @@ -301,3 +302,4 @@ linters:
- deadcode
- nosnakecase
- varcheck
- goconst
32 changes: 16 additions & 16 deletions bindings/azure/openai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ func (p *AzOpenAI) completion(ctx context.Context, message []byte, metadata map[
}

resp, err := p.client.GetCompletions(ctx, azopenai.CompletionsOptions{
DeploymentID: prompt.DeploymentID,
Prompt: []string{prompt.Prompt},
MaxTokens: &prompt.MaxTokens,
Temperature: &prompt.Temperature,
TopP: &prompt.TopP,
N: &prompt.N,
Stop: prompt.Stop,
Deployment: prompt.DeploymentID,
Prompt: []string{prompt.Prompt},
MaxTokens: &prompt.MaxTokens,
Temperature: &prompt.Temperature,
TopP: &prompt.TopP,
N: &prompt.N,
Stop: prompt.Stop,
}, nil)
if err != nil {
return nil, fmt.Errorf("error getting completion api: %w", err)
Expand Down Expand Up @@ -304,13 +304,13 @@ func (p *AzOpenAI) chatCompletion(ctx context.Context, messageRequest []byte, me
}

res, err := p.client.GetChatCompletions(ctx, azopenai.ChatCompletionsOptions{
DeploymentID: messages.DeploymentID,
MaxTokens: maxTokens,
Temperature: &messages.Temperature,
TopP: &messages.TopP,
N: &messages.N,
Messages: messageReq,
Stop: messages.Stop,
Deployment: messages.DeploymentID,
MaxTokens: maxTokens,
Temperature: &messages.Temperature,
TopP: &messages.TopP,
N: &messages.N,
Messages: messageReq,
Stop: messages.Stop,
}, nil)
if err != nil {
return nil, fmt.Errorf("error getting chat completion api: %w", err)
Expand Down Expand Up @@ -342,8 +342,8 @@ func (p *AzOpenAI) getEmbedding(ctx context.Context, messageRequest []byte, meta
}

res, err := p.client.GetEmbeddings(ctx, azopenai.EmbeddingsOptions{
DeploymentID: message.DeploymentID,
Input: []string{message.Message},
Deployment: message.DeploymentID,
Input: []string{message.Message},
}, nil)
if err != nil {
return nil, fmt.Errorf("error getting embedding api: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions bindings/influx/influx.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"fmt"
"reflect"

influxdb2 "github.com/influxdata/influxdb-client-go"
"github.com/influxdata/influxdb-client-go/api"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
"github.com/influxdata/influxdb-client-go/v2/api"

"github.com/dapr/components-contrib/bindings"
"github.com/dapr/components-contrib/metadata"
Expand Down
61 changes: 58 additions & 3 deletions bindings/influx/influx_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bindings/influx/influx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"testing"

"github.com/golang/mock/gomock"
influxdb2 "github.com/influxdata/influxdb-client-go"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
"github.com/stretchr/testify/assert"

"github.com/dapr/components-contrib/bindings"
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestInflux_Invoke_BindingCreateOperation(t *testing.T) {
defer ctrl.Finish()

w := NewMockWriteAPIBlocking(ctrl)
w.EXPECT().WriteRecord(gomock.Eq(context.Background()), gomock.Eq("a,a a")).Return(nil)
w.EXPECT().WriteRecord(gomock.Eq(context.TODO()), gomock.Eq("a,a a")).Return(nil)
influx := &Influx{
writeAPI: w,
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestInflux_Invoke_BindingQueryOperation(t *testing.T) {
defer ctrl.Finish()

q := NewMockQueryAPI(ctrl)
q.EXPECT().QueryRaw(gomock.Eq(context.Background()), gomock.Eq("a"), gomock.Eq(influxdb2.DefaultDialect())).Return("ok", nil)
q.EXPECT().QueryRaw(gomock.Eq(context.TODO()), gomock.Eq("a"), gomock.Eq(influxdb2.DefaultDialect())).Return("ok", nil)
influx := &Influx{
queryAPI: q,
logger: logger.NewLogger("test"),
Expand Down
2 changes: 1 addition & 1 deletion configuration/azure/appconfig/appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const (

type azAppConfigClient interface {
GetSetting(ctx context.Context, key string, options *azappconfig.GetSettingOptions) (azappconfig.GetSettingResponse, error)
NewListSettingsPager(selector azappconfig.SettingSelector, options *azappconfig.ListSettingsOptions) *runtime.Pager[azappconfig.ListSettingsPage]
NewListSettingsPager(selector azappconfig.SettingSelector, options *azappconfig.ListSettingsOptions) *runtime.Pager[azappconfig.ListSettingsPageResponse]
}

// ConfigurationStore is a Azure App Configuration store.
Expand Down
10 changes: 5 additions & 5 deletions configuration/azure/appconfig/appconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (m *MockConfigurationStore) GetSetting(ctx context.Context, key string, opt
return resp, nil
}

func (m *MockConfigurationStore) NewListSettingsPager(selector azappconfig.SettingSelector, options *azappconfig.ListSettingsOptions) *runtime.Pager[azappconfig.ListSettingsPage] {
func (m *MockConfigurationStore) NewListSettingsPager(selector azappconfig.SettingSelector, options *azappconfig.ListSettingsOptions) *runtime.Pager[azappconfig.ListSettingsPageResponse] {
settings := make([]azappconfig.Setting, 2)

setting1 := azappconfig.Setting{}
Expand All @@ -65,12 +65,12 @@ func (m *MockConfigurationStore) NewListSettingsPager(selector azappconfig.Setti
settings[0] = setting1
settings[1] = setting2

return runtime.NewPager(runtime.PagingHandler[azappconfig.ListSettingsPage]{
More: func(azappconfig.ListSettingsPage) bool {
return runtime.NewPager(runtime.PagingHandler[azappconfig.ListSettingsPageResponse]{
More: func(azappconfig.ListSettingsPageResponse) bool {
return false
},
Fetcher: func(ctx context.Context, cur *azappconfig.ListSettingsPage) (azappconfig.ListSettingsPage, error) {
listSettingPage := azappconfig.ListSettingsPage{}
Fetcher: func(ctx context.Context, cur *azappconfig.ListSettingsPageResponse) (azappconfig.ListSettingsPageResponse, error) {
listSettingPage := azappconfig.ListSettingsPageResponse{}
listSettingPage.Settings = settings
return listSettingPage, nil
},
Expand Down
Loading

0 comments on commit 0af7225

Please sign in to comment.