Skip to content

Commit

Permalink
Merge branch 'master' into add-e2e-workflow-purge
Browse files Browse the repository at this point in the history
  • Loading branch information
daixiang0 authored Dec 27, 2023
2 parents 6cb2727 + 9e2bcdc commit 94243ce
Show file tree
Hide file tree
Showing 130 changed files with 8,613 additions and 986 deletions.
3 changes: 3 additions & 0 deletions .build-tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-containerregistry v0.11.1-0.20220802162123-c1f9836a4fa9 h1:CUtt5NgbyWugcBKsuZ2MqU9sWtvnn9GlF7E0wCVkN2A=
github.com/google/go-containerregistry v0.11.1-0.20220802162123-c1f9836a4fa9/go.mod h1:jKEnAxppqUcGiMBChcvD0yTlWQwbZBitVvUeOaYUUTE=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down Expand Up @@ -79,9 +80,11 @@ golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
1 change: 1 addition & 0 deletions .github/scripts/dapr_bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const owners = [
'tanvigour',
'yaron2',
'rabollin',
'ashiquemd'
]

const SDKs = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 01ae6f45a75608c0322f9ac556b73d53fb3d8983 Mon Sep 17 00:00:00 2001
From: Shivam Kumar <shivamkm07@gmail.com>
Date: Tue, 19 Dec 2023 06:28:51 +0530
Subject: Remove Deprecated RenameReminder API from tests

Signed-off-by: Shivam Kumar <shivamkm07@gmail.com>
---
tests/apps/actorfeatures/app.go | 1 -
1 file changed, 1 deletion(-)

diff --git a/tests/apps/actorfeatures/app.go b/tests/apps/actorfeatures/app.go
index 9344f204..62e8c935 100644
--- a/tests/apps/actorfeatures/app.go
+++ b/tests/apps/actorfeatures/app.go
@@ -621,7 +621,6 @@ func nonHostedTestHandler(w http.ResponseWriter, r *http.Request) {
"GetReminder": {"GET", nil},
"CreateReminder": {"PUT", struct{}{}},
"DeleteReminder": {"DELETE", struct{}{}},
- "RenameReminder": {"PATCH", struct{}{}},
}
for op, t := range tests {
body, err := httpCall(t.Method, url, t.Body, http.StatusForbidden)
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
From 35be8001be203765d8ed160f614b4309981ae30b Mon Sep 17 00:00:00 2001
From: Shivam Kumar <shivamkm07@gmail.com>
Date: Tue, 19 Dec 2023 07:15:40 +0530
Subject: Added patch for updated http_metrics test in 1.12

Signed-off-by: Shivam Kumar <shivamkm07@gmail.com>
---
tests/e2e/metrics/metrics_test.go | 58 +++++++++++++++----------------
1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/tests/e2e/metrics/metrics_test.go b/tests/e2e/metrics/metrics_test.go
index 13baf6b5..94b1c2e9 100644
--- a/tests/e2e/metrics/metrics_test.go
+++ b/tests/e2e/metrics/metrics_test.go
@@ -33,6 +33,7 @@ import (
"github.com/dapr/dapr/tests/runner"
io_prometheus_client "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
+ "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -65,10 +66,7 @@ func TestMain(m *testing.M) {
MetricsEnabled: true,
},
{
- AppName: "grpcmetrics",
- // TODO: Some AKS clusters created before do not support CRD defaulting even
- // if Kubernetes version is 1.16/1.17 later.
- // Config: "obs-defaultmetric",
+ AppName: "grpcmetrics",
DaprEnabled: true,
ImageName: "e2e-stateapp",
Replicas: 1,
@@ -178,37 +176,30 @@ func invokeDaprHTTP(t *testing.T, app string, n, daprPort int) {
func testHTTPMetrics(t *testing.T, app string, res *http.Response) {
require.NotNil(t, res)

- foundMetric, foundPath := findHTTPMetricFromPrometheus(t, app, res)
+ foundMetric := findHTTPMetricFromPrometheus(t, app, res)

// Check metric was found
require.True(t, foundMetric)
- // Check metric with method was found
- require.True(t, foundPath)
}

func testMetricDisabled(t *testing.T, app string, res *http.Response) {
require.NotNil(t, res)

- foundMetric, foundPath := findHTTPMetricFromPrometheus(t, app, res)
+ foundMetric := findHTTPMetricFromPrometheus(t, app, res)

// Check metric was found
require.False(t, foundMetric)
- // Check metric with method was found
- require.False(t, foundPath)
}

-func findHTTPMetricFromPrometheus(t *testing.T, app string, res *http.Response) (bool, bool) {
+func findHTTPMetricFromPrometheus(t *testing.T, app string, res *http.Response) (foundMetric bool) {
rfmt := expfmt.ResponseFormat(res.Header)
require.NotEqual(t, rfmt, expfmt.FmtUnknown)

decoder := expfmt.NewDecoder(res.Body, rfmt)

// This test will loop through each of the metrics and look for a specifc
- // metric `dapr_http_server_request_count`. Once it finds the metric
- // it will check the `path` label is as expected for the invoked action.
- var foundMetric bool
- var foundPath bool
-
+ // metric `dapr_http_server_request_count`.
+ var foundHealthz, foundInvocation bool
for {
mf := &io_prometheus_client.MetricFamily{}
err := decoder.Decode(mf)
@@ -217,38 +208,45 @@ func findHTTPMetricFromPrometheus(t *testing.T, app string, res *http.Response)
}
require.NoError(t, err)

- if strings.EqualFold(mf.GetName(), "dapr_http_server_request_count") {
+ if strings.ToLower(mf.GetName()) == "dapr_http_server_request_count" {
foundMetric = true
+
for _, m := range mf.GetMetric() {
if m == nil {
continue
}
+ count := m.GetCounter()
+
// check metrics with expected method exists
for _, l := range m.GetLabel() {
if l == nil {
continue
}
- if strings.EqualFold(l.GetName(), "path") {
- foundPath = true
-
- if strings.Contains(l.GetValue(), "healthz") {
- if strings.Contains(l.GetValue(), "outbound") {
- require.Equal(t, "/v1.0/healthz/outbound", l.GetValue())
- } else {
- require.Equal(t, "/v1.0/healthz", l.GetValue())
+ val := l.GetValue()
+ switch strings.ToLower(l.GetName()) {
+ case "app_id":
+ assert.Equal(t, "httpmetrics", val)
+ case "method":
+ if count.GetValue() > 0 {
+ switch val {
+ case "Healthz":
+ foundHealthz = true
+ case "InvokeService/httpmetrics":
+ foundInvocation = true
}
- } else {
- require.Equal(t, fmt.Sprintf("/v1.0/invoke/%s/method/tests/green", app), l.GetValue())
}
-
- break
}
}
}
}
}

- return foundMetric, foundPath
+ if foundMetric {
+ require.True(t, foundHealthz)
+ require.True(t, foundInvocation)
+ }
+
+ return foundMetric
}

func invokeDaprGRPC(t *testing.T, app string, n, daprPort int) {
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From a662f110afba13ce24b51e83eaa9f4bf43b9aadf Mon Sep 17 00:00:00 2001
From: Shivam Kumar <shivamkm07@gmail.com>
Date: Fri, 22 Dec 2023 19:20:51 +0530
Subject: Setting IngressPort in workflow test

Signed-off-by: Shivam Kumar <shivamkm07@gmail.com>
---
tests/e2e/workflows/workflow_test.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/e2e/workflows/workflow_test.go b/tests/e2e/workflows/workflow_test.go
index 307c5456..00ed176d 100644
--- a/tests/e2e/workflows/workflow_test.go
+++ b/tests/e2e/workflows/workflow_test.go
@@ -52,12 +52,12 @@ func TestMain(m *testing.M) {
ImageName: "e2e-workflowsapp",
Replicas: 1,
IngressEnabled: true,
- MetricsEnabled: true,
+ IngressPort: 3000,
DaprMemoryLimit: "200Mi",
DaprMemoryRequest: "100Mi",
AppMemoryLimit: "200Mi",
AppMemoryRequest: "100Mi",
- AppPort: 3000,
+ AppPort: -1,
DebugLoggingEnabled: true,
},
}
--
2.34.1

9 changes: 8 additions & 1 deletion .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ jobs:
sudo apt-get update
sudo apt-get install pcre2-utils
- name: Create release branch and tag
run: ./.github/scripts/create-release.sh ${{ inputs.rel_version }}
env:
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
run: |
git config user.email "daprweb@microsoft.com"
git config user.name "Dapr Bot"
# Update origin with token
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
./.github/scripts/create-release.sh ${{ inputs.rel_version }}
2 changes: 1 addition & 1 deletion .github/workflows/version-skew-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
- name: Apply patches to latest release
run: |
export DAPR_LATEST_MAJOR_MINOR=$(echo ${{ env.DAPR_PREV_VERSION }} | cut -d. -f1-2)
export DAPR_PATCH_DIR="$(pwd)/.github/scripts/version-skew-test-patches/release-$DAPR_LATEST_MAJOR_MINOR"
export DAPR_PATCH_DIR="$(pwd)/.github/scripts/version-skew-test-patches/release-$DAPR_LATEST_MAJOR_MINOR/${{ matrix.mode }}"
if [ -d "$DAPR_PATCH_DIR" ]; then
echo "Applying patches from $DAPR_PATCH_DIR"
cd latest-release && git apply --ignore-space-change --ignore-whitespace $DAPR_PATCH_DIR/*.patch
Expand Down
13 changes: 12 additions & 1 deletion cmd/daprd/components/state_cockroachdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ package components

import (
"github.com/dapr/components-contrib/state/cockroachdb"
pgv2 "github.com/dapr/components-contrib/state/postgresql/v2"
"github.com/dapr/dapr/pkg/components"
stateLoader "github.com/dapr/dapr/pkg/components/state"
)

func init() {
stateLoader.DefaultRegistry.RegisterComponent(cockroachdb.New, "cockroachdb")
stateLoader.DefaultRegistry.RegisterComponentWithVersions("cockroachdb", components.Versioning{
Preferred: components.VersionConstructor{
// For v2, this component uses the same implementation as the postgres state store
Version: "v2", Constructor: pgv2.NewPostgreSQLStateStore,
},
Others: []components.VersionConstructor{
{Version: "v1", Constructor: cockroachdb.New},
},
Default: "v1",
})
}
40 changes: 38 additions & 2 deletions cmd/daprd/components/state_postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,46 @@ limitations under the License.
package components

import (
"github.com/dapr/components-contrib/state/postgresql"
pgv1 "github.com/dapr/components-contrib/state/postgresql/v1"
pgv2 "github.com/dapr/components-contrib/state/postgresql/v2"
"github.com/dapr/dapr/pkg/components"
stateLoader "github.com/dapr/dapr/pkg/components/state"
)

func init() {
stateLoader.DefaultRegistry.RegisterComponent(postgresql.NewPostgreSQLStateStore, "postgres", "postgresql")
// Note: for v2, cockroachdb uses the same implementation as postgres, but it's defined in state_cockroachdb.go
stateLoader.DefaultRegistry.RegisterComponentWithVersions("postgres", components.Versioning{
Preferred: components.VersionConstructor{
Version: "v2", Constructor: pgv2.NewPostgreSQLStateStore,
},
Others: []components.VersionConstructor{
{Version: "v1", Constructor: pgv1.NewPostgreSQLStateStore},
},
Default: "v1",
})

stateLoader.DefaultRegistry.RegisterComponentWithVersions("postgresql", components.Versioning{
Preferred: components.VersionConstructor{
Version: "v2", Constructor: pgv2.NewPostgreSQLStateStore,
},
Others: []components.VersionConstructor{
{Version: "v1", Constructor: pgv1.NewPostgreSQLStateStore},
},
Default: "v1",
})

// The v2 component can also be used with YugabyteDB
// There's no "v1" for YugabyteDB
stateLoader.DefaultRegistry.RegisterComponentWithVersions("yugabytedb", components.Versioning{
Preferred: components.VersionConstructor{
Version: "v2", Constructor: pgv2.NewPostgreSQLStateStore,
},
Default: "v2",
})
stateLoader.DefaultRegistry.RegisterComponentWithVersions("yugabyte", components.Versioning{
Preferred: components.VersionConstructor{
Version: "v2", Constructor: pgv2.NewPostgreSQLStateStore,
},
Default: "v2",
})
}
Loading

0 comments on commit 94243ce

Please sign in to comment.