diff --git a/server/linter/resource/manager.go b/server/linter/resource/manager.go index de9758babe..78e6b00731 100644 --- a/server/linter/resource/manager.go +++ b/server/linter/resource/manager.go @@ -84,7 +84,7 @@ func (r *Repository) Update(ctx context.Context, linter Linter) (Linter, error) return Linter{}, fmt.Errorf("sql exec delete: %w", err) } - var pluginsJSON []byte + pluginsJSON := []byte("[]") if updated.Plugins != nil { pluginsJSON, err = json.Marshal(updated.Plugins) if err != nil { diff --git a/testing/cli-e2etest/testscenarios/demo/resources/another-demo.yaml b/testing/cli-e2etest/testscenarios/demo/resources/another-demo.yaml index f4e72d2b16..d3268f2786 100644 --- a/testing/cli-e2etest/testscenarios/demo/resources/another-demo.yaml +++ b/testing/cli-e2etest/testscenarios/demo/resources/another-demo.yaml @@ -1,6 +1,6 @@ type: Demo spec: - id: 2fnji3_VR + id: ik_4OWuVg name: another-dev type: pokeshop enabled: true diff --git a/testing/cli-e2etest/testscenarios/demo/resources/new-demo.yaml b/testing/cli-e2etest/testscenarios/demo/resources/new-demo.yaml index bcfd60d7d9..1fced05456 100644 --- a/testing/cli-e2etest/testscenarios/demo/resources/new-demo.yaml +++ b/testing/cli-e2etest/testscenarios/demo/resources/new-demo.yaml @@ -1,6 +1,6 @@ type: Demo spec: - id: NBnjm3_4R + id: DglVOWu4g name: dev type: otelstore enabled: true diff --git a/testing/cli-e2etest/testscenarios/demo/resources/updated-new-demo.yaml b/testing/cli-e2etest/testscenarios/demo/resources/updated-new-demo.yaml index 136a922e35..a967911dcb 100644 --- a/testing/cli-e2etest/testscenarios/demo/resources/updated-new-demo.yaml +++ b/testing/cli-e2etest/testscenarios/demo/resources/updated-new-demo.yaml @@ -1,6 +1,6 @@ type: Demo spec: - id: _889i3l4g + id: DXc4OWXVR name: dev-updated type: otelstore enabled: true diff --git a/testing/cli-e2etest/testscenarios/environment/resources/another-environment.yaml b/testing/cli-e2etest/testscenarios/environment/resources/another-environment.yaml index 278d208042..c6a1274d78 100644 --- a/testing/cli-e2etest/testscenarios/environment/resources/another-environment.yaml +++ b/testing/cli-e2etest/testscenarios/environment/resources/another-environment.yaml @@ -3,7 +3,7 @@ spec: id: another-env name: another-env description: "" - createdAt: 2023-06-13T21:30:23.736515668Z + createdAt: 2023-06-15T22:14:11.945883377Z values: - key: Here value: We diff --git a/testing/cli-e2etest/testscenarios/environment/resources/new-environment.yaml b/testing/cli-e2etest/testscenarios/environment/resources/new-environment.yaml index 0153c854c0..e24f17bbd5 100644 --- a/testing/cli-e2etest/testscenarios/environment/resources/new-environment.yaml +++ b/testing/cli-e2etest/testscenarios/environment/resources/new-environment.yaml @@ -3,7 +3,7 @@ spec: id: .env name: .env description: "" - createdAt: 2023-06-13T21:30:23.72888471Z + createdAt: 2023-06-15T22:14:11.917313085Z values: - key: FIRST_VAR value: some-value diff --git a/testing/cli-e2etest/testscenarios/environment/resources/one-more-environment.yaml b/testing/cli-e2etest/testscenarios/environment/resources/one-more-environment.yaml index f633f144ca..863efcb368 100644 --- a/testing/cli-e2etest/testscenarios/environment/resources/one-more-environment.yaml +++ b/testing/cli-e2etest/testscenarios/environment/resources/one-more-environment.yaml @@ -3,7 +3,7 @@ spec: id: one-more-env name: one-more-env description: "" - createdAt: 2023-06-13T21:30:23.743358168Z + createdAt: 2023-06-15T22:14:11.971290461Z values: - key: This value: Is diff --git a/testing/cli-e2etest/testscenarios/environment/resources/updated-new-environment.yaml b/testing/cli-e2etest/testscenarios/environment/resources/updated-new-environment.yaml index dacd7f4b60..feb25ba68d 100644 --- a/testing/cli-e2etest/testscenarios/environment/resources/updated-new-environment.yaml +++ b/testing/cli-e2etest/testscenarios/environment/resources/updated-new-environment.yaml @@ -3,7 +3,7 @@ spec: id: .env name: .env description: "" - createdAt: 2023-06-13T21:30:10.439432Z + createdAt: 2023-06-15T22:13:58.234562Z values: - key: FIRST_VAR value: some-value diff --git a/testing/cli-e2etest/testscenarios/test/resources/api.proto b/testing/cli-e2etest/testscenarios/test/resources/api.proto index 3c2350ee07..e4e94d4bd5 100644 --- a/testing/cli-e2etest/testscenarios/test/resources/api.proto +++ b/testing/cli-e2etest/testscenarios/test/resources/api.proto @@ -14,11 +14,13 @@ service Pokeshop { message ImportPokemonRequest { int32 id = 1; + optional bool isFixed = 2; } message GetPokemonRequest { optional int32 skip = 1; optional int32 take = 2; + optional bool isFixed = 3; } message GetPokemonListResponse { diff --git a/testing/cli-e2etest/testscenarios/test/resources/environment-file.yaml b/testing/cli-e2etest/testscenarios/test/resources/environment-file.yaml index c5af472b7d..6ca87a0886 100644 --- a/testing/cli-e2etest/testscenarios/test/resources/environment-file.yaml +++ b/testing/cli-e2etest/testscenarios/test/resources/environment-file.yaml @@ -3,7 +3,7 @@ spec: id: pokeapi-env name: pokeapi-env description: "" - createdAt: 2023-06-13T21:32:12.710038Z + createdAt: 2023-06-15T22:16:08.965449Z values: - key: POKEMON_NAME value: snorlax diff --git a/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-embedded-protobuf.yaml b/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-embedded-protobuf.yaml index d96869127f..84e210ffb7 100644 --- a/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-embedded-protobuf.yaml +++ b/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-embedded-protobuf.yaml @@ -1,7 +1,7 @@ type: Test spec: id: create-pokemon - name: 'Create Pokemon' + name: "Create Pokemon" description: Create a single pokemon on Pokeshop trigger: type: grpc @@ -23,11 +23,13 @@ spec: message ImportPokemonRequest { int32 id = 1; + optional bool isFixed = 2; } message GetPokemonRequest { optional int32 skip = 1; optional int32 take = 2; + optional bool isFixed = 3; } message GetPokemonListResponse { @@ -52,7 +54,7 @@ spec: "isFeatured": true } specs: - - name: It calls Pokeshop correctly - selector: span[tracetest.span.type="rpc" name="createPokemon" rpc.system="grpc" rpc.method="createPokemon" rpc.service="Pokeshop.createPokemon"] - assertions: - - attr:rpc.grpc.status_code = 0 + - name: It calls Pokeshop correctly + selector: span[tracetest.span.type="rpc" name="pokeshop.Pokeshop/createPokemon" rpc.system="grpc" rpc.method="createPokemon" rpc.service="pokeshop.Pokeshop"] + assertions: + - attr:rpc.grpc.status_code = 0 diff --git a/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-reference-protobuf.yaml b/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-reference-protobuf.yaml index a79039c08f..1149226290 100644 --- a/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-reference-protobuf.yaml +++ b/testing/cli-e2etest/testscenarios/test/resources/grpc-trigger-reference-protobuf.yaml @@ -1,7 +1,7 @@ type: Test spec: id: create-pokemon - name: 'Create Pokemon' + name: "Create Pokemon" description: Create a single pokemon on Pokeshop trigger: type: grpc @@ -16,7 +16,7 @@ spec: "isFeatured": true } specs: - - name: It calls Pokeshop correctly - selector: span[tracetest.span.type="rpc" name="createPokemon" rpc.system="grpc" rpc.method="createPokemon" rpc.service="Pokeshop.createPokemon"] - assertions: - - attr:rpc.grpc.status_code = 0 + - name: It calls Pokeshop correctly + selector: span[tracetest.span.type="rpc" name="pokeshop.Pokeshop/createPokemon" rpc.system="grpc" rpc.method="createPokemon" rpc.service="pokeshop.Pokeshop"] + assertions: + - attr:rpc.grpc.status_code = 0 diff --git a/testing/cli-e2etest/testscenarios/test/resources/http-trigger-with-environment-file.yaml b/testing/cli-e2etest/testscenarios/test/resources/http-trigger-with-environment-file.yaml index 2feeac8d52..52f6c5011e 100644 --- a/testing/cli-e2etest/testscenarios/test/resources/http-trigger-with-environment-file.yaml +++ b/testing/cli-e2etest/testscenarios/test/resources/http-trigger-with-environment-file.yaml @@ -9,17 +9,18 @@ spec: url: http://demo-api:8081/pokemon method: POST headers: - - key: Content-Type - value: application/json + - key: Content-Type + value: application/json body: '{"name":"${env:POKEMON_NAME}","type":"normal","imageUrl":"${env:POKEMON_URL}","isFeatured":true}' specs: - - name: It should add a Pokemon correctly - selector: span[tracetest.span.type="http" name="POST /pokemon" http.method="POST"] - assertions: - - attr:http.status_code = 201 - - name: It should save the correct data - selector: span[tracetest.span.type="database" name="create pokeshop.pokemon" db.system="postgres" - db.name="postgres" db.user="postgres" db.operation="create" db.sql.table="pokemon"] - assertions: - - attr:db.result contains '"imageUrl":"${env:POKEMON_URL}"' - - attr:db.result contains '"name":"${env:POKEMON_NAME}"' + - name: It should add a Pokemon correctly + selector: span[tracetest.span.type="http" name="POST /pokemon" http.method="POST"] + assertions: + - attr:http.status_code = 201 + - name: It should save the correct data + selector: + span[tracetest.span.type="database" name="create postgres.pokemon" db.system="postgres" + db.name="postgres" db.user="postgres" db.operation="create" db.sql.table="pokemon"] + assertions: + - attr:db.result contains '"imageUrl":"${env:POKEMON_URL}"' + - attr:db.result contains '"name":"${env:POKEMON_NAME}"' diff --git a/testing/server-tracetesting/features/grpc_test/01_create_grpc_test.yml b/testing/server-tracetesting/features/grpc_test/01_create_grpc_test.yml index 624576ec89..9bb52ec4cd 100644 --- a/testing/server-tracetesting/features/grpc_test/01_create_grpc_test.yml +++ b/testing/server-tracetesting/features/grpc_test/01_create_grpc_test.yml @@ -17,7 +17,7 @@ spec: "serviceUnderTest": { "triggerType": "grpc", "grpc": { - "protobufFile": "syntax = \"proto3\";\r\n\r\noption java_multiple_files = true;\r\noption java_outer_classname = \"PokeshopProto\";\r\noption objc_class_prefix = \"PKS\";\r\n\r\npackage pokeshop;\r\n\r\nservice Pokeshop {\r\n rpc getPokemonList (GetPokemonRequest) returns (GetPokemonListResponse) {}\r\n rpc createPokemon (Pokemon) returns (Pokemon) {}\r\n rpc importPokemon (ImportPokemonRequest) returns (ImportPokemonRequest) {}\r\n}\r\n\r\nmessage ImportPokemonRequest {\r\n int32 id = 1;\r\n}\r\n\r\nmessage GetPokemonRequest {\r\n optional int32 skip = 1;\r\n optional int32 take = 2;\r\n}\r\n\r\nmessage GetPokemonListResponse {\r\n repeated Pokemon items = 1;\r\n int32 totalCount = 2;\r\n}\r\n\r\nmessage Pokemon {\r\n optional int32 id = 1;\r\n string name = 2;\r\n string type = 3;\r\n bool isFeatured = 4;\r\n optional string imageUrl = 5;\r\n}", + "protobufFile": "syntax = \"proto3\";\n\noption java_multiple_files = true;\noption java_outer_classname = \"PokeshopProto\";\noption objc_class_prefix = \"PKS\";\n\npackage pokeshop;\n\nservice Pokeshop {\n rpc getPokemonList (GetPokemonRequest) returns (GetPokemonListResponse) {}\n rpc createPokemon (Pokemon) returns (Pokemon) {}\n rpc importPokemon (ImportPokemonRequest) returns (ImportPokemonRequest) {}\n}\n\nmessage ImportPokemonRequest {\n int32 id = 1;\n optional bool isFixed = 2;\n}\n\nmessage GetPokemonRequest {\n optional int32 skip = 1;\n optional int32 take = 2;\n optional bool isFixed = 3;\n}\n\nmessage GetPokemonListResponse {\n repeated Pokemon items = 1;\n int32 totalCount = 2;\n}\n\nmessage Pokemon {\n optional int32 id = 1;\n string name = 2;\n string type = 3;\n bool isFeatured = 4;\n optional string imageUrl = 5;\n}", "address": "${env:DEMO_APP_GRPC_URL}", "method": "pokeshop.Pokeshop.importPokemon", "request": "{\"id\": 52}" @@ -26,7 +26,7 @@ spec: "specs": [ { "selectorParsed": { - "query": "span[name = \"queue.synchronizePokemon send\"]" + "query": "span[name = \"queue.synchronizePokemon publish\"]" }, "assertions": ["attr:tracetest.selected_spans.count > 0"] } diff --git a/testing/server-tracetesting/features/grpc_test/05_create_grpc_test_with_invalid_metadata.yml b/testing/server-tracetesting/features/grpc_test/05_create_grpc_test_with_invalid_metadata.yml index 2a2c41b55c..168d4c645e 100644 --- a/testing/server-tracetesting/features/grpc_test/05_create_grpc_test_with_invalid_metadata.yml +++ b/testing/server-tracetesting/features/grpc_test/05_create_grpc_test_with_invalid_metadata.yml @@ -9,15 +9,15 @@ spec: url: ${env:TARGET_URL}/api/tests method: POST headers: - - key: Content-Type - value: application/json + - key: Content-Type + value: application/json body: | { "name": "gRPC pokemon list", "serviceUnderTest": { "triggerType": "grpc", "grpc": { - "protobufFile": "syntax = \"proto3\";\r\n\r\noption java_multiple_files = true;\r\noption java_outer_classname = \"PokeshopProto\";\r\noption objc_class_prefix = \"PKS\";\r\n\r\npackage pokeshop;\r\n\r\nservice Pokeshop {\r\n rpc getPokemonList (GetPokemonRequest) returns (GetPokemonListResponse) {}\r\n rpc createPokemon (Pokemon) returns (Pokemon) {}\r\n rpc importPokemon (ImportPokemonRequest) returns (ImportPokemonRequest) {}\r\n}\r\n\r\nmessage ImportPokemonRequest {\r\n int32 id = 1;\r\n}\r\n\r\nmessage GetPokemonRequest {\r\n optional int32 skip = 1;\r\n optional int32 take = 2;\r\n}\r\n\r\nmessage GetPokemonListResponse {\r\n repeated Pokemon items = 1;\r\n int32 totalCount = 2;\r\n}\r\n\r\nmessage Pokemon {\r\n optional int32 id = 1;\r\n string name = 2;\r\n string type = 3;\r\n bool isFeatured = 4;\r\n optional string imageUrl = 5;\r\n}", + "protobufFile": "syntax = \"proto3\";\n\noption java_multiple_files = true;\noption java_outer_classname = \"PokeshopProto\";\noption objc_class_prefix = \"PKS\";\n\npackage pokeshop;\n\nservice Pokeshop {\n rpc getPokemonList (GetPokemonRequest) returns (GetPokemonListResponse) {}\n rpc createPokemon (Pokemon) returns (Pokemon) {}\n rpc importPokemon (ImportPokemonRequest) returns (ImportPokemonRequest) {}\n}\n\nmessage ImportPokemonRequest {\n int32 id = 1;\n optional bool isFixed = 2;\n}\n\nmessage GetPokemonRequest {\n optional int32 skip = 1;\n optional int32 take = 2;\n optional bool isFixed = 3;\n}\n\nmessage GetPokemonListResponse {\n repeated Pokemon items = 1;\n int32 totalCount = 2;\n}\n\nmessage Pokemon {\n optional int32 id = 1;\n string name = 2;\n string type = 3;\n bool isFeatured = 4;\n optional string imageUrl = 5;\n}", "address": "${env:DEMO_APP_GRPC_URL}", "method": "pokeshop.Pokeshop.importPokemon", "request": "{\"id\": 52}", @@ -27,27 +27,27 @@ spec: "specs": [ { "selectorParsed": { - "query": "span[name = \"queue.synchronizePokemon send\"]" + "query": "span[name = \"queue.synchronizePokemon publish\"]" }, "assertions": ["attr:tracetest.selected_spans.count > 0"] } ] } specs: - - selector: span[name = "Tracetest trigger"] - assertions: - - attr:tracetest.selected_spans.count = 1 - - attr:tracetest.response.status = 200 - - selector: span[name="POST /api/tests" tracetest.span.type="http"] - assertions: - - attr:tracetest.selected_spans.count = 1 - - selector: span[name = "exec INSERT"] - assertions: - - attr:tracetest.selected_spans.count = 1 - - selector: span[name = "exec INSERT"]:first - assertions: - - attr:sql.query contains "INSERT INTO tests" + - selector: span[name = "Tracetest trigger"] + assertions: + - attr:tracetest.selected_spans.count = 1 + - attr:tracetest.response.status = 200 + - selector: span[name="POST /api/tests" tracetest.span.type="http"] + assertions: + - attr:tracetest.selected_spans.count = 1 + - selector: span[name = "exec INSERT"] + assertions: + - attr:tracetest.selected_spans.count = 1 + - selector: span[name = "exec INSERT"]:first + assertions: + - attr:sql.query contains "INSERT INTO tests" outputs: - - name: GRPC_TEST_INVALID_METADATA_ID - selector: span[name = "Tracetest trigger"] - value: attr:tracetest.response.body | json_path '$.id' + - name: GRPC_TEST_INVALID_METADATA_ID + selector: span[name = "Tracetest trigger"] + value: attr:tracetest.response.body | json_path '$.id' diff --git a/testing/server-tracetesting/features/http_test/05_create_http_test.yml b/testing/server-tracetesting/features/http_test/05_create_http_test.yml index 00fda808f9..6aa391af7b 100644 --- a/testing/server-tracetesting/features/http_test/05_create_http_test.yml +++ b/testing/server-tracetesting/features/http_test/05_create_http_test.yml @@ -30,7 +30,7 @@ spec: "specs": [ { "selectorParsed": { - "query": "span[name = \"pg.query:SELECT postgres\"]" + "query": "span[name = \"findMany postgres.pokemon\"]" }, "assertions": ["attr:tracetest.selected_spans.count > 0"] }