From 64704fa8f9b41250cb904ce65fc407dd84f2741f Mon Sep 17 00:00:00 2001 From: RazenaSaleem Date: Tue, 4 Jun 2024 11:38:13 +0530 Subject: [PATCH] test: add qt test files Signed-off-by: RazenaSaleem --- test/git_azure.yaml | 35 +++++++++++++++++++++++++++++++++++ test/git_bitbucket.yaml | 35 +++++++++++++++++++++++++++++++++++ test/git_gitea.yaml | 30 ++++++++++++++++++++++++++++++ test/git_github.yaml | 37 +++++++++++++++++++++++++++++++++++++ test/git_gitlab.yaml | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 171 insertions(+) create mode 100644 test/git_azure.yaml create mode 100644 test/git_bitbucket.yaml create mode 100644 test/git_gitea.yaml create mode 100644 test/git_github.yaml create mode 100644 test/git_gitlab.yaml diff --git a/test/git_azure.yaml b/test/git_azure.yaml new file mode 100644 index 00000000..c5684d01 --- /dev/null +++ b/test/git_azure.yaml @@ -0,0 +1,35 @@ +type: Test +spec: + id: IHTebvYIR + name: git-azure + trigger: + type: http + httpRequest: + method: POST + url: http://gitbridge.aws.optimizor.app/azure + body: "{\n \"id\": \"03c164c2-8912-4d5e-8009-3707d5f83734\",\n \"eventType\": \"git.push\",\n \"publisherId\": \"tfs\",\n \"scope\": \"all\",\n \"message\": {\n \"text\": \"Jamal Hartnett pushed updates to branch master of repository Fabrikam-Fiber-Git.\",\n \"html\": \"Jamal Hartnett pushed updates to branch master of repository Fabrikam-Fiber-Git.\",\n \"markdown\": \"Jamal Hartnett pushed updates to branch `master` of repository `Fabrikam-Fiber-Git`.\"\n },\n \"detailedMessage\": {\n \"text\": \"Jamal Hartnett pushed 1 commit to branch master of repository Fabrikam-Fiber-Git.\\n - Fixed bug in web.config file 33b55f7c\",\n \"html\": \"Jamal Hartnett pushed 1 commit to branch master of repository Fabrikam-Fiber-Git.\\n\",\n \"markdown\": \"Jamal Hartnett pushed 1 commit to branch [master](https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_git/Fabrikam-Fiber-Git/#version=GBmaster) of repository [Fabrikam-Fiber-Git](https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_git/Fabrikam-Fiber-Git/).\\n* Fixed bug in web.config file [33b55f7c](https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_git/Fabrikam-Fiber-Git/commit/33b55f7cb7e7e245323987634f960cf4a6e6bc74)\"\n },\n \"resource\": {\n \"commits\": [\n {\n \"commitId\": \"33b55f7cb7e7e245323987634f960cf4a6e6bc74\",\n \"author\": {\n \"name\": \"QT\",\n \"email\": \"fabrikamfiber4@hotmail.com\",\n \"date\": \"2015-02-25T19:01:00Z\"\n },\n \"committer\": {\n \"name\": \"Jamal Hartnett\",\n \"email\": \"fabrikamfiber4@hotmail.com\",\n \"date\": \"2015-02-25T19:01:00Z\"\n },\n \"comment\": \"Fixed bug in web.config file\",\n \"url\": \"https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_git/Fabrikam-Fiber-Git/commit/33b55f7cb7e7e245323987634f960cf4a6e6bc74\"\n }\n ],\n \"refUpdates\": [\n {\n \"name\": \"refs/heads/main\",\n \"oldObjectId\": \"aad331d8d3b131fa9ae03cf5e53965b51942618a\",\n \"newObjectId\": \"33b55f7cb7e7e245323987634f960cf4a6e6bc74\"\n }\n ],\n \"repository\": {\n \"id\": \"278d5cd2-584d-4b63-824a-2ba458937249\",\n \"name\": \"Fabrikam-Fiber-Git\",\n \"url\": \"https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_apis/repos/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249\",\n \"project\": {\n \"id\": \"6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c\",\n \"name\": \"Fabrikam-Fiber-Git\",\n \"url\": \"https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c\",\n \"state\": \"wellFormed\"\n },\n \"defaultBranch\": \"refs/heads/main\",\n \"remoteUrl\": \"https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_git/Fabrikam-Fiber-Git\"\n },\n \"pushedBy\": {\n \"id\": \"00067FFED5C7AF52@Live.com\",\n \"displayName\": \"QT\",\n \"uniqueName\": \"Windows Live ID\\\\fabrikamfiber4@hotmail.com\"\n },\n \"pushId\": 14,\n \"date\": \"2014-05-02T19:17:13.3309587Z\",\n \"url\": \"https://dev.azure.com/fabrikam-fiber-inc/DefaultCollection/_apis/repos/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/pushes/14\"\n },\n \"resourceVersion\": \"1.0\",\n \"resourceContainers\": {\n \"collection\": {\n \"id\": \"c12d0eb8-e382-443b-9f9c-c52cba5014c2\"\n },\n \"account\": {\n \"id\": \"f844ec47-a9db-4511-8281-8b63f4eaf94e\"\n },\n \"project\": {\n \"id\": \"be9b3917-87e6-42a4-a549-2bc06a7a878f\"\n }\n },\n \"createdDate\": \"2016-09-19T13:03:27.0379153Z\"\n }" + headers: + - key: Content-Type + value: application/json + specs: + - selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:name = "Tracetest trigger" + - attr:tracetest.response.status = 200 + - attr:tracetest.span.name = "Tracetest trigger" + - attr:tracetest.span.type = "general" + - selector: span[tracetest.span.type="http" name="/azure" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:http.route = "/azure" + - attr:http.scheme = "http" + - attr:net.host.name = "kubviz" + - attr:tracetest.span.type = "http" + - attr:name = "/azure" + - attr:http.status_code = 200 + - selector: span[tracetest.span.type="http" name="PostAzure" http.method="POST"] + assertions: + - attr:name = "PostAzure" + - attr:http.method = "POST" + - attr:tracetest.span.name = "PostAzure" + - attr:tracetest.span.type = "http" diff --git a/test/git_bitbucket.yaml b/test/git_bitbucket.yaml new file mode 100644 index 00000000..be2c17e3 --- /dev/null +++ b/test/git_bitbucket.yaml @@ -0,0 +1,35 @@ +type: Test +spec: + id: EPVfwDYIg + name: git-bitbucket + trigger: + type: http + httpRequest: + method: POST + url: https://gitbridge.aws.optimizor.app/bitbucket + body: "{\n \"actor\":{\n \"nickname\":\"emmap1\",\n \"account_id\":\"udfy9suggmzpswxc7n200y3c\",\n \"display_name\":\"QT\",\n \"uuid\":\"{a54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3}\",\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/api/2.0/users/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"html\":{\n \"href\":\"https://api.bitbucket.org/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"avatar\":{\n \"href\":\"https://bitbucket-api-assetroot.s3.amazonaws.com/c/photos/2015/Feb/26/3613917261-0-emmap1-avatar_avatar.png\"\n }\n }\n },\n \"repository\":{\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/api/2.0/repositories/bitbucket/bitbucket\"\n },\n \"html\":{\n \"href\":\"https://api.bitbucket.org/bitbucket/bitbucket\"\n },\n \"avatar\":{\n \"href\":\"https://api-staging-assetroot.s3.amazonaws.com/c/photos/2014/Aug/01/bitbucket-logo-2629490769-3_avatar.png\"\n }\n },\n \"uuid\":\"{673a6070-3421-46c9-9d48-90745f7bfe8e}\",\n \"full_name\":\"team_name/repo_name\",\n \"name\":\"repo_name\",\n \"scm\":\"git\",\n \"is_private\":true\n },\n \"push\":{\n \"changes\":[\n {\n \"new\":{\n \"type\":\"branch\",\n \"name\":\"name-of-branch\",\n \"target\":{\n \"type\":\"commit\",\n \"hash\":\"709d658dc5b6d6afcd46049c2f332ee3f515a67d\",\n \"author\":{\n \"nickname\":\"emmap1\",\n \"account_id\":\"udfy9suggmzpswxc7n200y3c\",\n \"display_name\":\"QT\",\n \"uuid\":\"{a54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3}\",\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/api/2.0/users/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"html\":{\n \"href\":\"https://api.bitbucket.org/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"avatar\":{\n \"href\":\"https://bitbucket-api-assetroot.s3.amazonaws.com/c/photos/2015/Feb/26/3613917261-0-emmap1-avatar_avatar.png\"\n }\n }\n },\n \"message\":\"new commit message\\n\",\n \"date\":\"2015-06-09T03:34:49+00:00\",\n \"parents\":[\n {\n \"type\":\"commit\",\n \"hash\":\"1e65c05c1d5171631d92438a13901ca7dae9618c\",\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/commit/8cbbd65829c7ad834a97841e0defc965718036a0\"\n },\n \"html\":{\n \"href\":\"https://bitbucket.org/user_name/repo_name/commits/8cbbd65829c7ad834a97841e0defc965718036a0\"\n }\n }\n }\n ],\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/commit/c4b2b7914156a878aa7c9da452a09fb50c2091f2\"\n },\n \"html\":{\n \"href\":\"https://bitbucket.org/user_name/repo_name/commits/c4b2b7914156a878aa7c9da452a09fb50c2091f2\"\n }\n }\n },\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/refs/branches/master\"\n },\n \"commits\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/commits/master\"\n },\n \"html\":{\n \"href\":\"https://bitbucket.org/user_name/repo_name/branch/master\"\n }\n }\n },\n \"old\":{\n \"type\":\"branch\",\n \"name\":\"name-of-branch\",\n \"target\":{\n \"type\":\"commit\",\n \"hash\":\"1e65c05c1d5171631d92438a13901ca7dae9618c\",\n \"author\":{\n \"nickname\":\"emmap1\",\n \"account_id\":\"udfy9suggmzpswxc7n200y3c\",\n \"display_name\":\"QT\",\n \"uuid\":\"{a54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3}\",\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/api/2.0/users/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"html\":{\n \"href\":\"https://api.bitbucket.org/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"avatar\":{\n \"href\":\"https://bitbucket-api-assetroot.s3.amazonaws.com/c/photos/2015/Feb/26/3613917261-0-emmap1-avatar_avatar.png\"\n }\n }\n },\n \"message\":\"old commit message\\n\",\n \"date\":\"2015-06-08T21:34:56+00:00\",\n \"parents\":[\n {\n \"type\":\"commit\",\n \"hash\":\"e0d0c2041e09746be5ce4b55067d5a8e3098c843\",\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/commit/9c4a3452da3bc4f37af5a6bb9c784246f44406f7\"\n },\n \"html\":{\n \"href\":\"https://bitbucket.org/user_name/repo_name/commits/9c4a3452da3bc4f37af5a6bb9c784246f44406f7\"\n }\n }\n }\n ],\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/commit/b99ea6dad8f416e57c5ca78c1ccef590600d841b\"\n },\n \"html\":{\n \"href\":\"https://bitbucket.org/user_name/repo_name/commits/b99ea6dad8f416e57c5ca78c1ccef590600d841b\"\n }\n }\n },\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/refs/branches/master\"\n },\n \"commits\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/commits/master\"\n },\n \"html\":{\n \"href\":\"https://bitbucket.org/user_name/repo_name/branch/master\"\n }\n }\n },\n \"links\":{\n \"html\":{\n \"href\":\"https://bitbucket.org/user_name/repo_name/branches/compare/c4b2b7914156a878aa7c9da452a09fb50c2091f2..b99ea6dad8f416e57c5ca78c1ccef590600d841b\"\n },\n \"diff\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/diff/c4b2b7914156a878aa7c9da452a09fb50c2091f2..b99ea6dad8f416e57c5ca78c1ccef590600d841b\"\n },\n \"commits\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user_name/repo_name/commits?include=c4b2b7914156a878aa7c9da452a09fb50c2091f2&exclude=b99ea6dad8f416e57c5ca78c1ccef590600d841b\"\n }\n },\n \"created\":false,\n \"forced\":false,\n \"closed\":false,\n \"commits\":[\n {\n \"hash\":\"03f4a7270240708834de475bcf21532d6134777e\",\n \"type\":\"commit\",\n \"message\":\"commit message\\n\",\n \"author\":{\n \"nickname\":\"emmap1\",\n \"account_id\":\"udfy9suggmzpswxc7n200y3c\",\n \"display_name\":\"QT\",\n \"uuid\":\"{a54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3}\",\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/api/2.0/users/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"html\":{\n \"href\":\"https://api.bitbucket.org/%7Ba54f16da-24e9-4d7f-a3a7-b1ba2cd98aa3%7D\"\n },\n \"avatar\":{\n \"href\":\"https://bitbucket-api-assetroot.s3.amazonaws.com/c/photos/2015/Feb/26/3613917261-0-emmap1-avatar_avatar.png\"\n }\n }\n },\n \"links\":{\n \"self\":{\n \"href\":\"https://api.bitbucket.org/2.0/repositories/user/repo/commit/03f4a7270240708834de475bcf21532d6134777e\"\n },\n \"html\":{\n \"href\":\"https://bitbucket.org/user/repo/commits/03f4a7270240708834de475bcf21532d6134777e\"\n }\n }\n }\n ],\n \"truncated\":false\n }\n ]\n }\n}" + headers: + - key: Content-Type + value: application/json + - key: X-Event-Key + value: repo:push + specs: + - selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:name = "Tracetest trigger" + - attr:tracetest.response.status = 200 + - attr:tracetest.span.type = "general" + - selector: span[tracetest.span.type="http" name="/bitbucket" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:http.route = "/bitbucket" + - attr:http.scheme = "http" + - attr:http.status_code = 200 + - attr:name = "/bitbucket" + - attr:net.host.name = "kubviz" + - attr:tracetest.span.type = "http" + - selector: span[tracetest.span.type="http" name="PostBitbucket" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:tracetest.span.name = "PostBitbucket" + - attr:tracetest.span.type = "http" diff --git a/test/git_gitea.yaml b/test/git_gitea.yaml new file mode 100644 index 00000000..0c48bb22 --- /dev/null +++ b/test/git_gitea.yaml @@ -0,0 +1,30 @@ +type: Test +spec: + id: nfhmaDYSR + name: git-gitea + trigger: + type: http + httpRequest: + method: POST + url: http://gitbridge.aws.optimizor.app/gitea + body: "{\n \"ref\": \"refs/heads/master\",\n \"before\": \"0000000000000000000000000000000000000000\",\n \"after\": \"67b56589a45103f891bdee7c0546e5d40bc02001\",\n \"compare_url\": \"http://localhost:3000/example/example/compare/0000000000000000000000000000000000000000...67b56589a45103f891bdee7c0546e5d40bc02001\",\n \"commits\": [\n {\n \"id\": \"67b56589a45103f891bdee7c0546e5d40bc02001\",\n \"message\": \"example\\n\",\n \"url\": \"http://localhost:3000/example/example/commit/67b56589a45103f891bdee7c0546e5d40bc02001\",\n \"author\": {\n \"name\": \"QT\",\n \"email\": \"example@example.com\",\n \"username\": \"\"\n },\n \"committer\": {\n \"name\": \"example\",\n \"email\": \"example@example.com\",\n \"username\": \"\"\n },\n \"verification\": null,\n \"timestamp\": \"2022-03-09T16:23:39+09:00\",\n \"added\": [\n \"example\"\n ],\n \"removed\": [],\n \"modified\": []\n }\n ],\n \"head_commit\": {\n \"id\": \"67b56589a45103f891bdee7c0546e5d40bc02001\",\n \"message\": \"example\\n\",\n \"url\": \"http://localhost:3000/example/example/commit/67b56589a45103f891bdee7c0546e5d40bc02001\",\n \"author\": {\n \"name\": \"QT\",\n \"email\": \"example@example.com\",\n \"username\": \"\"\n },\n \"committer\": {\n \"name\": \"example\",\n \"email\": \"example@example.com\",\n \"username\": \"\"\n },\n \"verification\": null,\n \"timestamp\": \"2022-03-09T16:23:39+09:00\",\n \"added\": [\n \"example\"\n ],\n \"removed\": [],\n \"modified\": []\n },\n \"repository\": {\n \"id\": 1,\n \"owner\": {\n \"id\": 1,\n \"login\": \"example\",\n \"full_name\": \"\",\n \"email\": \"example@example.com\",\n \"avatar_url\": \"http://localhost:3000/avatar/23463b99b62a72f26ed677cc556c44e8\",\n \"language\": \"\",\n \"is_admin\": false,\n \"last_login\": \"0001-01-01T00:00:00Z\",\n \"created\": \"2022-03-09T16:14:22+09:00\",\n \"restricted\": false,\n \"active\": false,\n \"prohibit_login\": false,\n \"location\": \"\",\n \"website\": \"\",\n \"description\": \"\",\n \"visibility\": \"public\",\n \"followers_count\": 0,\n \"following_count\": 0,\n \"starred_repos_count\": 0,\n \"username\": \"example\"\n },\n \"name\": \"example\",\n \"full_name\": \"example/example\",\n \"description\": \"\",\n \"empty\": false,\n \"private\": false,\n \"fork\": false,\n \"template\": false,\n \"parent\": null,\n \"mirror\": false,\n \"size\": 89,\n \"html_url\": \"http://localhost:3000/example/example\",\n \"ssh_url\": \"git@localhost:example/example.git\",\n \"clone_url\": \"http://localhost:3000/example/example.git\",\n \"original_url\": \"\",\n \"website\": \"\",\n \"stars_count\": 0,\n \"forks_count\": 0,\n \"watchers_count\": 1,\n \"open_issues_count\": 1,\n \"open_pr_counter\": 0,\n \"release_counter\": 0,\n \"default_branch\": \"master\",\n \"archived\": false,\n \"created_at\": \"2022-03-09T16:14:29+09:00\",\n \"updated_at\": \"2022-03-09T16:23:53+09:00\",\n \"permissions\": {\n \"admin\": true,\n \"push\": true,\n \"pull\": true\n },\n \"has_issues\": true,\n \"internal_tracker\": {\n \"enable_time_tracker\": true,\n \"allow_only_contributors_to_track_time\": true,\n \"enable_issue_dependencies\": true\n },\n \"has_wiki\": true,\n \"has_pull_requests\": true,\n \"has_projects\": true,\n \"ignore_whitespace_conflicts\": false,\n \"allow_merge_commits\": true,\n \"allow_rebase\": true,\n \"allow_rebase_explicit\": true,\n \"allow_squash_merge\": true,\n \"default_merge_style\": \"merge\",\n \"avatar_url\": \"\",\n \"internal\": false,\n \"mirror_interval\": \"\",\n \"mirror_updated\": \"0001-01-01T00:00:00Z\",\n \"repo_transfer\": null\n },\n \"pusher\": {\n \"id\": 1,\n \"login\": \"example\",\n \"full_name\": \"\",\n \"email\": \"example@example.com\",\n \"avatar_url\": \"http://localhost:3000/avatar/23463b99b62a72f26ed677cc556c44e8\",\n \"language\": \"\",\n \"is_admin\": false,\n \"last_login\": \"0001-01-01T00:00:00Z\",\n \"created\": \"2022-03-09T16:14:22+09:00\",\n \"restricted\": false,\n \"active\": false,\n \"prohibit_login\": false,\n \"location\": \"\",\n \"website\": \"\",\n \"description\": \"\",\n \"visibility\": \"public\",\n \"followers_count\": 0,\n \"following_count\": 0,\n \"starred_repos_count\": 0,\n \"username\": \"example\"\n },\n \"sender\": {\n \"id\": 1,\n \"login\": \"example\",\n \"full_name\": \"\",\n \"email\": \"example@example.com\",\n \"avatar_url\": \"http://localhost:3000/avatar/23463b99b62a72f26ed677cc556c44e8\",\n \"language\": \"\",\n \"is_admin\": false,\n \"last_login\": \"0001-01-01T00:00:00Z\",\n \"created\": \"2022-03-09T16:14:22+09:00\",\n \"restricted\": false,\n \"active\": false,\n \"prohibit_login\": false,\n \"location\": \"\",\n \"website\": \"\",\n \"description\": \"\",\n \"visibility\": \"public\",\n \"followers_count\": 0,\n \"following_count\": 0,\n \"starred_repos_count\": 0,\n \"username\": \"example\"\n }\n}" + headers: + - key: Content-Type + value: application/json + - key: X-Gitea-Event + value: push + specs: + - selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.status = 200 + - attr:tracetest.span.name = "Tracetest trigger" + - attr:tracetest.span.type = "general" + - selector: span[tracetest.span.type="http" name="/gitea" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:http.route = "/gitea" + - attr:http.scheme = "http" + - attr:http.status_code = 200 + - attr:net.host.name = "kubviz" + - attr:tracetest.span.name = "/gitea" + - attr:tracetest.span.type = "http" diff --git a/test/git_github.yaml b/test/git_github.yaml new file mode 100644 index 00000000..edcc6c39 --- /dev/null +++ b/test/git_github.yaml @@ -0,0 +1,37 @@ +type: Test +spec: + id: atlDbvLSg + name: git-github + trigger: + type: http + httpRequest: + method: POST + url: https://gitbridge.aws.optimizor.app/github + body: "{\n \"ref\": \"refs/heads/master\",\n \"before\": \"737d38c599c1b2991664dfc6155d6bf516fcce36\",\n \"after\": \"fd489864e7642b48eaad6e3f155c10e46810ec72\",\n \"created\": false,\n \"deleted\": false,\n \"forced\": false,\n \"base_ref\": null,\n \"compare\": \"https://github.com/binkkatal/sample_app/compare/737d38c599c1...fd489864e764\",\n \"commits\": [\n {\n \"id\": \"fd489864e7642b48eaad6e3f155c10e46810ec72\",\n \"tree_id\": \"55e08136e14d5168b699038f88c73e175ddffd3b\",\n \"distinct\": true,\n \"message\": \"test a push event\",\n \"timestamp\": \"2018-06-29T19:34:13+05:30\",\n \"url\": \"https://github.com/binkkatal/sample_app/commit/fd489864e7642b48eaad6e3f155c10e46810ec72\",\n \"author\": {\n \"name\": \"QT\",\n \"email\": \"binkkatal.r@gmail.com\",\n \"username\": \"binkkatal\"\n },\n \"committer\": {\n \"name\": \"binkkatal\",\n \"email\": \"binkkatal.r@gmail.com\",\n \"username\": \"binkkatal\"\n },\n \"added\": [\n \".razorops.yaml\"\n ],\n \"removed\": [\n ],\n \"modified\": [\n \"app/controllers/application_controller.rb\"\n ]\n }\n ],\n \"head_commit\": {\n \"id\": \"fd489864e7642b48eaad6e3f155c10e46810ec72\",\n \"tree_id\": \"55e08136e14d5168b699038f88c73e175ddffd3b\",\n \"distinct\": true,\n \"message\": \"test a push event\",\n \"timestamp\": \"2018-06-29T19:34:13+05:30\",\n \"url\": \"https://github.com/binkkatal/sample_app/commit/fd489864e7642b48eaad6e3f155c10e46810ec72\",\n \"author\": {\n \"name\": \"QT\",\n \"email\": \"binkkatal.r@gmail.com\",\n \"username\": \"binkkatal\"\n },\n \"committer\": {\n \"name\": \"binkkatal\",\n \"email\": \"binkkatal.r@gmail.com\",\n \"username\": \"binkkatal\"\n },\n \"added\": [\n \".razorops.yaml\"\n ],\n \"removed\": [\n ],\n \"modified\": [\n \"app/controllers/application_controller.rb\"\n ]\n },\n \"repository\": {\n \"id\": 63933911,\n \"node_id\": \"MDEwOlJlcG9zaXRvcnk2MzkzMzkxMQ==\",\n \"name\": \"sample_app\",\n \"full_name\": \"binkkatal/sample_app\",\n \"owner\": {\n \"name\": \"binkkatal\",\n \"email\": \"binkkatal.r@gmail.com\",\n \"login\": \"binkkatal\",\n \"id\": 13351472,\n \"node_id\": \"MDQ6VXNlcjEzMzUxNDcy\",\n \"avatar_url\": \"https://avatars3.githubusercontent.com/u/13351472?v=4\",\n \"gravatar_id\": \"\",\n \"url\": \"https://api.github.com/users/binkkatal\",\n \"html_url\": \"https://github.com/binkkatal\",\n \"followers_url\": \"https://api.github.com/users/binkkatal/followers\",\n \"following_url\": \"https://api.github.com/users/binkkatal/following{/other_user}\",\n \"gists_url\": \"https://api.github.com/users/binkkatal/gists{/gist_id}\",\n \"starred_url\": \"https://api.github.com/users/binkkatal/starred{/owner}{/repo}\",\n \"subscriptions_url\": \"https://api.github.com/users/binkkatal/subscriptions\",\n \"organizations_url\": \"https://api.github.com/users/binkkatal/orgs\",\n \"repos_url\": \"https://api.github.com/users/binkkatal/repos\",\n \"events_url\": \"https://api.github.com/users/binkkatal/events{/privacy}\",\n \"received_events_url\": \"https://api.github.com/users/binkkatal/received_events\",\n \"type\": \"User\",\n \"site_admin\": false\n },\n \"private\": false,\n \"html_url\": \"https://github.com/binkkatal/sample_app\",\n \"description\": null,\n \"fork\": false,\n \"url\": \"https://github.com/binkkatal/sample_app\",\n \"forks_url\": \"https://api.github.com/repos/binkkatal/sample_app/forks\",\n \"keys_url\": \"https://api.github.com/repos/binkkatal/sample_app/keys{/key_id}\",\n \"collaborators_url\": \"https://api.github.com/repos/binkkatal/sample_app/collaborators{/collaborator}\",\n \"teams_url\": \"https://api.github.com/repos/binkkatal/sample_app/teams\",\n \"hooks_url\": \"https://api.github.com/repos/binkkatal/sample_app/hooks\",\n \"issue_events_url\": \"https://api.github.com/repos/binkkatal/sample_app/issues/events{/number}\",\n \"events_url\": \"https://api.github.com/repos/binkkatal/sample_app/events\",\n \"assignees_url\": \"https://api.github.com/repos/binkkatal/sample_app/assignees{/user}\",\n \"branches_url\": \"https://api.github.com/repos/binkkatal/sample_app/branches{/branch}\",\n \"tags_url\": \"https://api.github.com/repos/binkkatal/sample_app/tags\",\n \"blobs_url\": \"https://api.github.com/repos/binkkatal/sample_app/git/blobs{/sha}\",\n \"git_tags_url\": \"https://api.github.com/repos/binkkatal/sample_app/git/tags{/sha}\",\n \"git_refs_url\": \"https://api.github.com/repos/binkkatal/sample_app/git/refs{/sha}\",\n \"trees_url\": \"https://api.github.com/repos/binkkatal/sample_app/git/trees{/sha}\",\n \"statuses_url\": \"https://api.github.com/repos/binkkatal/sample_app/statuses/{sha}\",\n \"languages_url\": \"https://api.github.com/repos/binkkatal/sample_app/languages\",\n \"stargazers_url\": \"https://api.github.com/repos/binkkatal/sample_app/stargazers\",\n \"contributors_url\": \"https://api.github.com/repos/binkkatal/sample_app/contributors\",\n \"subscribers_url\": \"https://api.github.com/repos/binkkatal/sample_app/subscribers\",\n \"subscription_url\": \"https://api.github.com/repos/binkkatal/sample_app/subscription\",\n \"commits_url\": \"https://api.github.com/repos/binkkatal/sample_app/commits{/sha}\",\n \"git_commits_url\": \"https://api.github.com/repos/binkkatal/sample_app/git/commits{/sha}\",\n \"comments_url\": \"https://api.github.com/repos/binkkatal/sample_app/comments{/number}\",\n \"issue_comment_url\": \"https://api.github.com/repos/binkkatal/sample_app/issues/comments{/number}\",\n \"contents_url\": \"https://api.github.com/repos/binkkatal/sample_app/contents/{+path}\",\n \"compare_url\": \"https://api.github.com/repos/binkkatal/sample_app/compare/{base}...{head}\",\n \"merges_url\": \"https://api.github.com/repos/binkkatal/sample_app/merges\",\n \"archive_url\": \"https://api.github.com/repos/binkkatal/sample_app/{archive_format}{/ref}\",\n \"downloads_url\": \"https://api.github.com/repos/binkkatal/sample_app/downloads\",\n \"issues_url\": \"https://api.github.com/repos/binkkatal/sample_app/issues{/number}\",\n \"pulls_url\": \"https://api.github.com/repos/binkkatal/sample_app/pulls{/number}\",\n \"milestones_url\": \"https://api.github.com/repos/binkkatal/sample_app/milestones{/number}\",\n \"notifications_url\": \"https://api.github.com/repos/binkkatal/sample_app/notifications{?since,all,participating}\",\n \"labels_url\": \"https://api.github.com/repos/binkkatal/sample_app/labels{/name}\",\n \"releases_url\": \"https://api.github.com/repos/binkkatal/sample_app/releases{/id}\",\n \"deployments_url\": \"https://api.github.com/repos/binkkatal/sample_app/deployments\",\n \"created_at\": 1469173225,\n \"updated_at\": \"2016-07-22T07:48:39Z\",\n \"pushed_at\": 1530281075,\n \"git_url\": \"git://github.com/binkkatal/sample_app.git\",\n \"ssh_url\": \"git@github.com:binkkatal/sample_app.git\",\n \"clone_url\": \"https://github.com/binkkatal/sample_app.git\",\n \"svn_url\": \"https://github.com/binkkatal/sample_app\",\n \"homepage\": null,\n \"size\": 23,\n \"stargazers_count\": 0,\n \"watchers_count\": 0,\n \"language\": \"Ruby\",\n \"has_issues\": true,\n \"has_projects\": true,\n \"has_downloads\": true,\n \"has_wiki\": true,\n \"has_pages\": false,\n \"forks_count\": 0,\n \"mirror_url\": null,\n \"archived\": false,\n \"open_issues_count\": 0,\n \"license\": null,\n \"forks\": 0,\n \"open_issues\": 0,\n \"watchers\": 0,\n \"default_branch\": \"master\",\n \"stargazers\": 0,\n \"master_branch\": \"master\"\n },\n \"pusher\": {\n \"name\": \"binkkatal\",\n \"email\": \"binkkatal.r@gmail.com\"\n },\n \"sender\": {\n \"login\": \"binkkatal\",\n \"id\": 13351472,\n \"node_id\": \"MDQ6VXNlcjEzMzUxNDcy\",\n \"avatar_url\": \"https://avatars3.githubusercontent.com/u/13351472?v=4\",\n \"gravatar_id\": \"\",\n \"url\": \"https://api.github.com/users/binkkatal\",\n \"html_url\": \"https://github.com/binkkatal\",\n \"followers_url\": \"https://api.github.com/users/binkkatal/followers\",\n \"following_url\": \"https://api.github.com/users/binkkatal/following{/other_user}\",\n \"gists_url\": \"https://api.github.com/users/binkkatal/gists{/gist_id}\",\n \"starred_url\": \"https://api.github.com/users/binkkatal/starred{/owner}{/repo}\",\n \"subscriptions_url\": \"https://api.github.com/users/binkkatal/subscriptions\",\n \"organizations_url\": \"https://api.github.com/users/binkkatal/orgs\",\n \"repos_url\": \"https://api.github.com/users/binkkatal/repos\",\n \"events_url\": \"https://api.github.com/users/binkkatal/events{/privacy}\",\n \"received_events_url\": \"https://api.github.com/users/binkkatal/received_events\",\n \"type\": \"User\",\n \"site_admin\": false\n }\n}" + headers: + - key: Content-Type + value: application/json + - key: X-GitHub-Event + value: push + specs: + - selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:name = "Tracetest trigger" + - attr:tracetest.response.status = 200 + - attr:tracetest.span.name = "Tracetest trigger" + - attr:tracetest.span.type = "general" + - selector: span[tracetest.span.type="http" name="/github" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:http.route = "/github" + - attr:http.scheme = "http" + - attr:http.status_code = 200 + - attr:net.host.name = "kubviz" + - attr:tracetest.span.name = "/github" + - attr:tracetest.span.type = "http" + - selector: span[tracetest.span.type="http" name="PostGithub" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:name = "PostGithub" + - attr:tracetest.span.name = "PostGithub" + - attr:tracetest.span.type = "http" diff --git a/test/git_gitlab.yaml b/test/git_gitlab.yaml new file mode 100644 index 00000000..17dcc419 --- /dev/null +++ b/test/git_gitlab.yaml @@ -0,0 +1,34 @@ +type: Test +spec: + id: pnJ1wDYIg + name: git-gitlab + trigger: + type: http + httpRequest: + method: POST + url: https://gitbridge.aws.optimizor.app/gitlab + body: "{\n \"object_kind\": \"push\",\n \"before\": \"95790bf891e76fee5e1747ab589903a6a1f80f22\",\n \"after\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"ref\": \"refs/heads/master\",\n \"checkout_sha\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"user_id\": 4,\n \"user_name\": \"John Smith\",\n \"user_email\": \"john@example.com\",\n \"user_avatar\": \"https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80\",\n \"project_id\": 15,\n \"project\":{\n \"name\":\"Diaspora\",\n \"description\":\"\",\n \"web_url\":\"http://example.com/mike/diaspora\",\n \"avatar_url\":null,\n \"git_ssh_url\":\"git@example.com:mike/diaspora.git\",\n \"git_http_url\":\"http://example.com/mike/diaspora.git\",\n \"namespace\":\"Mike\",\n \"visibility_level\":0,\n \"path_with_namespace\":\"mike/diaspora\",\n \"default_branch\":\"master\",\n \"homepage\":\"http://example.com/mike/diaspora\",\n \"url\":\"git@example.com:mike/diaspora.git\",\n \"ssh_url\":\"git@example.com:mike/diaspora.git\",\n \"http_url\":\"http://example.com/mike/diaspora.git\"\n },\n \"repository\":{\n \"name\": \"Diaspora\",\n \"url\": \"git@example.com:mike/diaspora.git\",\n \"description\": \"\",\n \"homepage\": \"http://example.com/mike/diaspora\",\n \"git_http_url\":\"http://example.com/mike/diaspora.git\",\n \"git_ssh_url\":\"git@example.com:mike/diaspora.git\",\n \"visibility_level\":0\n },\n \"commits\": [\n {\n \"id\": \"b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327\",\n \"message\": \"Update Catalan translation to e38cb41.\",\n \"timestamp\": \"2011-12-12T14:27:31+02:00\",\n \"url\": \"http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327\",\n \"author\": {\n \"name\": \"QT\",\n \"email\": \"jordi@softcatala.org\"\n },\n \"added\": [\"CHANGELOG\"],\n \"modified\": [\"app/controller/application.rb\"],\n \"removed\": []\n },\n {\n \"id\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"message\": \"fixed readme\",\n \"timestamp\": \"2012-01-03T23:36:29+02:00\",\n \"url\": \"http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"author\": {\n \"name\": \"GitLab dev user\",\n \"email\": \"gitlabdev@dv6700.(none)\"\n },\n \"added\": [\"CHANGELOG\"],\n \"modified\": [\"app/controller/application.rb\"],\n \"removed\": []\n }\n ],\n \"total_commits_count\": 4\n}" + headers: + - key: Content-Type + value: application/json + - key: X-Gitlab-Event + value: Push Hook + specs: + - selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:name = "Tracetest trigger" + - attr:tracetest.response.status = 200 + - attr:tracetest.span.type = "general" + - selector: span[tracetest.span.type="http" name="/gitlab" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:http.route = "/gitlab" + - attr:http.status_code = 200 + - attr:net.host.name = "kubviz" + - attr:tracetest.span.name = "/gitlab" + - attr:tracetest.span.type = "http" + - selector: span[tracetest.span.type="http" name="PostGitlab" http.method="POST"] + assertions: + - attr:http.method = "POST" + - attr:tracetest.span.name = "PostGitlab" + - attr:tracetest.span.type = "http"