Skip to content

Commit

Permalink
Merge branch 'master' into kaibocai/reuse-id
Browse files Browse the repository at this point in the history
  • Loading branch information
kaibocai committed Dec 19, 2023
2 parents 0205b9c + d7775f8 commit 33f1fd7
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 3 deletions.
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

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
3 changes: 1 addition & 2 deletions pkg/config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ const (
// Disables enforcing minimum TLS version 1.2 in AppChannel, which is insecure.
// TODO: Remove this feature flag in Dapr 1.13.
AppChannelAllowInsecureTLS Feature = "AppChannelAllowInsecureTLS"
// Enables support for setting TTL on Actor state keys. Remove this flag in
// Dapr 1.12.
// Enables support for setting TTL on Actor state keys.
ActorStateTTL Feature = "ActorStateTTL"
)

Expand Down

0 comments on commit 33f1fd7

Please sign in to comment.