You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/08/05 10:46:39 UTC

[skywalking-infra-e2e] branch main updated: Support `hasPrefix` and `hasSuffix` string verifier (#83)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git


The following commit(s) were added to refs/heads/main by this push:
     new a53a70a  Support `hasPrefix` and `hasSuffix` string verifier (#83)
a53a70a is described below

commit a53a70a2696b3c42984f857e0562bea87b9fa7ee
Author: mrproliu <74...@qq.com>
AuthorDate: Fri Aug 5 18:46:34 2022 +0800

    Support `hasPrefix` and `hasSuffix` string verifier (#83)
---
 CHANGES.md                          | 1 +
 docs/en/setup/Configuration-File.md | 2 ++
 third-party/go/template/funcs.go    | 4 ++++
 3 files changed, 7 insertions(+)

diff --git a/CHANGES.md b/CHANGES.md
index 513c644..357f4f0 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Release Notes.
 ------------------
 #### Features
 * Support `sha256enc` and `sha512enc` encoding in verify case.
+* Support `hasPrefix` and `hasSuffix` string verifier in verify case.
 
 #### Bug Fixes
 
diff --git a/docs/en/setup/Configuration-File.md b/docs/en/setup/Configuration-File.md
index 0c05613..d10a93f 100644
--- a/docs/en/setup/Configuration-File.md
+++ b/docs/en/setup/Configuration-File.md
@@ -209,6 +209,8 @@ Verify that the number fits the range.
 |le|Verify the first param is less than or equals second param |{{le param1 param2}}|param1|<wanted gt $param2, but was $param1>|
 |regexp|Verify the first param matches the second regular expression|{{regexp param1 param2}}|param1|<"$param1" does not match the pattern $param2">|
 |notEmpty|Verify The param is not empty|{{notEmpty param}}|param|<"" is empty, wanted is not empty>|
+|hasPrefix|Verify The string param has the same prefix.|{{hasPrefix param1 param2}}|true|false|
+|hasSuffix|Verify The string param has the same suffix.|{{hasSuffix param1 param2}}|true|false|
 
 ##### List Matches
 
diff --git a/third-party/go/template/funcs.go b/third-party/go/template/funcs.go
index 49c1ee7..f01dedf 100644
--- a/third-party/go/template/funcs.go
+++ b/third-party/go/template/funcs.go
@@ -58,6 +58,10 @@ func builtins() FuncMap {
 		"le": le, // <=
 		"lt": lt, // <
 		"ne": ne, // !=
+
+		// string comparisons
+		"hasPrefix": strings.HasPrefix,
+		"hasSuffix": strings.HasSuffix,
 	}
 }