From ce28bfd5aee5a8988c1ed6c7c907fef7cd2a07b5 Mon Sep 17 00:00:00 2001 From: heyanlong Date: Thu, 19 Mar 2020 11:03:40 +0800 Subject: [PATCH 1/8] fix #4539, add PHP to the query protocol --- .../query-graphql-plugin/src/main/resources/query-protocol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol index 06373bf0d120..28f18ae8dab4 160000 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol @@ -1 +1 @@ -Subproject commit 06373bf0d1204b6d3f410c0daf4c7f72529f28a0 +Subproject commit 28f18ae8dab49e60eb3d2e5cfd1a5c884a897ad0 From c707f29c832908b0322a0945c1757b9573025b69 Mon Sep 17 00:00:00 2001 From: heyanlong Date: Fri, 20 Mar 2020 19:43:37 +0800 Subject: [PATCH 2/8] Add PHP module support to e2e test --- .../e2e-test/docker/php/docker-compose.yml | 86 +++++ test/e2e/e2e-test/docker/php/index.php | 25 ++ test/e2e/e2e-test/docker/php/php-shadow.ini | 21 ++ test/e2e/e2e-test/docker/php/php.ini | 21 ++ .../org/apache/skywalking/e2e/PHPE2E.java | 293 ++++++++++++++++++ .../test/resources/expected/php/endpoints.yml | 23 ++ .../test/resources/expected/php/instances.yml | 27 ++ .../expected/php/serviceInstanceTopo.yml | 34 ++ .../test/resources/expected/php/services.yml | 20 ++ .../expected/php/shadowEndpoints.yml | 21 ++ .../expected/php/shadowInstances.yml | 27 ++ .../src/test/resources/expected/php/topo.yml | 40 +++ .../test/resources/expected/php/traces.yml | 32 ++ 13 files changed, 670 insertions(+) create mode 100644 test/e2e/e2e-test/docker/php/docker-compose.yml create mode 100644 test/e2e/e2e-test/docker/php/index.php create mode 100644 test/e2e/e2e-test/docker/php/php-shadow.ini create mode 100644 test/e2e/e2e-test/docker/php/php.ini create mode 100644 test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/PHPE2E.java create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/endpoints.yml create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/instances.yml create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/serviceInstanceTopo.yml create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/services.yml create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/shadowEndpoints.yml create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/topo.yml create mode 100644 test/e2e/e2e-test/src/test/resources/expected/php/traces.yml diff --git a/test/e2e/e2e-test/docker/php/docker-compose.yml b/test/e2e/e2e-test/docker/php/docker-compose.yml new file mode 100644 index 000000000000..cb10fad1d3bd --- /dev/null +++ b/test/e2e/e2e-test/docker/php/docker-compose.yml @@ -0,0 +1,86 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: '2.1' + +services: + oap: + image: skywalking/oap:latest + expose: + - 11800 + - 12800 + networks: + - e2e + restart: on-failure + healthcheck: + test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/11800"] + interval: 5s + timeout: 60s + retries: 120 + + php: + image: skyapm/skywalking-php:latest + networks: + e2e: + aliases: + - php + expose: + - 8080 + environment: + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=oap:11800 + depends_on: + oap: + condition: service_healthy + volumes: + - ../php/index.php:/opt/www/index.php + - ../php/php.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini + + php-shadow: + image: skyapm/skywalking-php:latest + networks: + e2e: + aliases: + - php-shadow + expose: + - 8080 + environment: + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=oap:11800 + depends_on: + php: + condition: service_started + oap: + condition: service_healthy + volumes: + - ../php/index.php:/opt/www/index.php + - ../php/php-shadow.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini + + ui: + image: skywalking/ui:latest + expose: + - 8080 + networks: + - e2e + environment: + - SW_OAP_ADDRESS=oap:12800 + depends_on: + php: + condition: service_started + php-shadow: + condition: service_started + oap: + condition: service_healthy + +networks: + e2e: \ No newline at end of file diff --git a/test/e2e/e2e-test/docker/php/index.php b/test/e2e/e2e-test/docker/php/index.php new file mode 100644 index 000000000000..330e60fdf285 --- /dev/null +++ b/test/e2e/e2e-test/docker/php/index.php @@ -0,0 +1,25 @@ + justForSideEffects; + + @SuppressWarnings("unused") + @ContainerHostAndPort(name = "ui", port = 8080) + private HostAndPort swWebappHostPort; + + @SuppressWarnings("unused") + @ContainerHostAndPort(name = "php", port = 8080) + private HostAndPort phpHostPort; + + @SuppressWarnings("unused") + @ContainerHostAndPort(name = "php-shadow", port = 8080) + private HostAndPort phpShadowHostPort; + + private final String shadowServiceName = "php-shadow"; + + @BeforeAll + public void setUp() throws Exception { + URL url = new URL("http", phpHostPort.host(), phpHostPort.port(), "/init"); + restTemplate.getForObject(url.toURI(), String.class); + Thread.sleep(1000); + url = new URL("http", phpShadowHostPort.host(), phpShadowHostPort.port(), "/init-shadow"); + restTemplate.getForObject(url.toURI(), String.class); + Thread.sleep(1000); + queryClient(swWebappHostPort); + + trafficController(phpHostPort, "/php/info"); + } + + @AfterAll + public void tearDown() { + trafficController.stop(); + } + + @RetryableTest + void services() throws Exception { + final List services = graphql.services(new ServicesQuery().start(startTime).end(now())); + + LOGGER.info("services: {}", services); + + load("expected/php/services.yml").as(ServicesMatcher.class).verify(services); + + for (Service service : services) { + LOGGER.info("verifying service instances: {}", service); + + verifyServiceMetrics(service); + + final Instances instances = verifyServiceInstances(service); + + verifyInstancesMetrics(instances); + + final Endpoints endpoints = verifyServiceEndpoints(service); + + verifyEndpointsMetrics(endpoints); + } + } + + @RetryableTest + void traces() throws Exception { + final List traces = graphql.traces(new TracesQuery().start(startTime).end(now()).orderByStartTime()); + + LOGGER.info("traces: {}", traces); + + load("expected/php/traces.yml").as(TracesMatcher.class).verifyLoosely(traces); + } + + @RetryableTest + void topology() throws Exception { + final Topology topology = graphql.topo(new TopoQuery().stepByMinute().start(startTime.minusDays(1)).end(now())); + + LOGGER.info("topology: {}", topology); + + load("expected/php/topo.yml").as(TopoMatcher.class).verify(topology); + + verifyServiceRelationMetrics(topology.getCalls()); + } + + @RetryableTest + void serviceInstances() throws Exception { + + final ServiceInstanceTopology topology = graphql.serviceInstanceTopo( + new ServiceInstanceTopologyQuery().stepByMinute() + .start(startTime.minusDays(1)) + .end(now()) + .clientServiceId("1") + .serverServiceId("2")); + + LOGGER.info("topology: {}", topology); + + load("expected/php/serviceInstanceTopo.yml").as(ServiceInstanceTopologyMatcher.class).verify(topology); + + verifyServiceInstanceRelationMetrics(topology.getCalls()); + } + + private Instances verifyServiceInstances(final Service service) throws Exception { + final Instances instances = graphql.instances( + new InstancesQuery().serviceId(service.getKey()).start(startTime).end(now()) + ); + + LOGGER.info("instances: {} {}", service.getLabel(), instances); + + if (shadowServiceName.equals(service.getLabel())) { + load("expected/php/shadowInstances.yml").as(InstancesMatcher.class).verify(instances); + } else { + load("expected/php/instances.yml").as(InstancesMatcher.class).verify(instances); + } + + return instances; + } + + private Endpoints verifyServiceEndpoints(final Service service) throws Exception { + final Endpoints endpoints = graphql.endpoints(new EndpointQuery().serviceId(service.getKey())); + + LOGGER.info("endpoints: {} {}", service.getLabel(), endpoints); + + if (shadowServiceName.equals(service.getLabel())) { + load("expected/php/shadowEndpoints.yml").as(EndpointsMatcher.class).verify(endpoints); + } else { + load("expected/php/endpoints.yml").as(EndpointsMatcher.class).verify(endpoints); + } + + return endpoints; + } + + private void verifyInstancesMetrics(Instances instances) throws Exception { + for (Instance instance : instances.getInstances()) { + for (String metricsName : ALL_INSTANCE_METRICS) { + LOGGER.info("verifying service instance response time: {}", instance); + final Metrics instanceMetrics = graphql.metrics( + new MetricsQuery().stepByMinute().metricsName(metricsName).id(instance.getKey()) + ); + + LOGGER.info("instance metrics: {}", instanceMetrics); + + final AtLeastOneOfMetricsMatcher instanceRespTimeMatcher = new AtLeastOneOfMetricsMatcher(); + final MetricsValueMatcher greaterThanZero = new MetricsValueMatcher(); + greaterThanZero.setValue("gt 0"); + instanceRespTimeMatcher.setValue(greaterThanZero); + instanceRespTimeMatcher.verify(instanceMetrics); + LOGGER.info("{}: {}", metricsName, instanceMetrics); + } + } + } + + private void verifyEndpointsMetrics(Endpoints endpoints) throws Exception { + for (Endpoint endpoint : endpoints.getEndpoints()) { + if (!endpoint.getLabel().equals("/info") || !endpoint.getLabel().equals("/php/info")) { + continue; + } + for (final String metricName : ALL_ENDPOINT_METRICS) { + LOGGER.info("verifying endpoint {}: {}", endpoint, metricName); + + final Metrics metrics = graphql.metrics( + new MetricsQuery().stepByMinute().metricsName(metricName).id(endpoint.getKey()) + ); + + LOGGER.info("metrics: {}", metrics); + + final AtLeastOneOfMetricsMatcher instanceRespTimeMatcher = new AtLeastOneOfMetricsMatcher(); + final MetricsValueMatcher greaterThanZero = new MetricsValueMatcher(); + greaterThanZero.setValue("gt 0"); + instanceRespTimeMatcher.setValue(greaterThanZero); + instanceRespTimeMatcher.verify(metrics); + + LOGGER.info("{}: {}", metricName, metrics); + } + } + } + + private void verifyServiceMetrics(final Service service) throws Exception { + for (String metricName : ALL_SERVICE_METRICS) { + LOGGER.info("verifying service {}, metrics: {}", service, metricName); + final Metrics serviceMetrics = graphql.metrics( + new MetricsQuery().stepByMinute().metricsName(metricName).id(service.getKey()) + ); + LOGGER.info("serviceMetrics: {}", serviceMetrics); + final AtLeastOneOfMetricsMatcher instanceRespTimeMatcher = new AtLeastOneOfMetricsMatcher(); + final MetricsValueMatcher greaterThanZero = new MetricsValueMatcher(); + greaterThanZero.setValue("gt 0"); + instanceRespTimeMatcher.setValue(greaterThanZero); + instanceRespTimeMatcher.verify(serviceMetrics); + LOGGER.info("{}: {}", metricName, serviceMetrics); + } + } + + private void verifyServiceInstanceRelationMetrics(final List calls) throws Exception { + verifyRelationMetrics( + calls, ALL_SERVICE_INSTANCE_RELATION_CLIENT_METRICS, + ALL_SERVICE_INSTANCE_RELATION_SERVER_METRICS + ); + } + + private void verifyServiceRelationMetrics(final List calls) throws Exception { + verifyRelationMetrics(calls, ALL_SERVICE_RELATION_CLIENT_METRICS, ALL_SERVICE_RELATION_SERVER_METRICS); + } + + private void verifyRelationMetrics(final List calls, + final String[] relationClientMetrics, + final String[] relationServerMetrics) throws Exception { + for (Call call : calls) { + for (String detectPoint : call.getDetectPoints()) { + switch (detectPoint) { + case "CLIENT": { + for (String metricName : relationClientMetrics) { + verifyMetrics(graphql, metricName, call.getId(), startTime); + } + break; + } + case "SERVER": { + for (String metricName : relationServerMetrics) { + verifyMetrics(graphql, metricName, call.getId(), startTime); + } + break; + } + } + } + } + } +} diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/endpoints.yml b/test/e2e/e2e-test/src/test/resources/expected/php/endpoints.yml new file mode 100644 index 000000000000..73249ee12948 --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/endpoints.yml @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +endpoints: + - key: not null + label: /php/info + - key: not null + label: /php/call + + + diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/instances.yml b/test/e2e/e2e-test/src/test/resources/expected/php/instances.yml new file mode 100644 index 000000000000..11a7aff14a69 --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/instances.yml @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +instances: + - key: 2 + label: not null + attributes: + - name: os_name + value: not null + - name: host_name + value: not null + - name: process_no + value: gt 0 + - name: ipV4s + value: not null diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/serviceInstanceTopo.yml b/test/e2e/e2e-test/src/test/resources/expected/php/serviceInstanceTopo.yml new file mode 100644 index 000000000000..238e70a9ab14 --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/serviceInstanceTopo.yml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +nodes: + - id: 1 + name: User + type: USER + serviceId: 1 + serviceName: User + isReal: false + - id: 2 + name: not null + serviceId: 2 + serviceName: php + type: not null + isReal: true +calls: + - id: 1_2 + source: 1 + detectPoints: + - SERVER + target: 2 diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/services.yml b/test/e2e/e2e-test/src/test/resources/expected/php/services.yml new file mode 100644 index 000000000000..d57c2a5e408a --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/services.yml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +services: + - key: gt 0 + label: "php" + - key: gt 0 + label: "php-shadow" \ No newline at end of file diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/shadowEndpoints.yml b/test/e2e/e2e-test/src/test/resources/expected/php/shadowEndpoints.yml new file mode 100644 index 000000000000..969d1c233aae --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/shadowEndpoints.yml @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +endpoints: + - key: not null + label: /php/call + + + diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml b/test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml new file mode 100644 index 000000000000..46ed6858b1ac --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +instances: + - key: 3 + label: not null + attributes: + - name: os_name + value: not null + - name: host_name + value: not null + - name: process_no + value: gt 0 + - name: ipV4s + value: not null diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/topo.yml b/test/e2e/e2e-test/src/test/resources/expected/php/topo.yml new file mode 100644 index 000000000000..09462de1b809 --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/topo.yml @@ -0,0 +1,40 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +nodes: + - id: 1 + name: User + type: USER + isReal: false + - id: 2 + name: php + type: HttpClient + isReal: true + - id: 3 + name: php-shadow + type: HttpClient + isReal: true +calls: + - id: 1_2 + source: 1 + detectPoints: + - SERVER + target: 2 + - id: 2_3 + source: 2 + detectPoints: + - CLIENT + - SERVER + target: 3 \ No newline at end of file diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/traces.yml b/test/e2e/e2e-test/src/test/resources/expected/php/traces.yml new file mode 100644 index 000000000000..f558c2ec76c5 --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/expected/php/traces.yml @@ -0,0 +1,32 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +traces: + - key: not null + endpointNames: + - /php/info + duration: ge 0 + start: gt 0 + isError: false + traceIds: + - not null + - key: not null + endpointNames: + - /php/call + duration: ge 0 + start: gt 0 + isError: false + traceIds: + - not null \ No newline at end of file From f84cb2cd3c8024f1c6a14a63c16c1841c2db920c Mon Sep 17 00:00:00 2001 From: heyanlong Date: Sat, 21 Mar 2020 15:51:27 +0800 Subject: [PATCH 3/8] Add PHP e2e test into the CI control file --- .github/workflows/e2e.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 8ee9d812d453..4c563f7907fe 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -80,6 +80,28 @@ jobs: name: logs path: logs + FeatureGroup03: + name: PHP + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: checkout submodules + shell: bash + run: | + git submodule sync --recursive + git -c protocol.version=2 submodule update --init --force --recursive --depth=1 + - name: Compile and Build + run: make docker + - name: Copy dist package + run: cp -R dist test/e2e/ + - name: PHP + run: ./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.PHPE2E + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: logs + path: logs + Gateway: name: Gateway runs-on: ubuntu-latest From 544200e5ebc3a25aa0fb720620fd6356c59f9f2c Mon Sep 17 00:00:00 2001 From: heyanlong Date: Sat, 21 Mar 2020 16:22:54 +0800 Subject: [PATCH 4/8] Remove networks aliases --- .../e2e-test/docker/php/docker-compose.yml | 22 ++++++--------- test/e2e/e2e-test/docker/php/php-shadow.ini | 28 +++++++++---------- test/e2e/e2e-test/docker/php/php.ini | 28 +++++++++---------- .../expected/php/shadowInstances.yml | 2 +- 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/test/e2e/e2e-test/docker/php/docker-compose.yml b/test/e2e/e2e-test/docker/php/docker-compose.yml index cb10fad1d3bd..dd0f25bacc22 100644 --- a/test/e2e/e2e-test/docker/php/docker-compose.yml +++ b/test/e2e/e2e-test/docker/php/docker-compose.yml @@ -30,12 +30,10 @@ services: timeout: 60s retries: 120 - php: + php-shadow: image: skyapm/skywalking-php:latest networks: - e2e: - aliases: - - php + - e2e expose: - 8080 environment: @@ -44,27 +42,25 @@ services: oap: condition: service_healthy volumes: - - ../php/index.php:/opt/www/index.php - - ../php/php.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini + - ./index.php:/opt/www/index.php + - ./php-shadow.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini - php-shadow: + php: image: skyapm/skywalking-php:latest networks: - e2e: - aliases: - - php-shadow + - e2e expose: - 8080 environment: - SW_AGENT_COLLECTOR_BACKEND_SERVICES=oap:11800 depends_on: - php: + php-shadow: condition: service_started oap: condition: service_healthy volumes: - - ../php/index.php:/opt/www/index.php - - ../php/php-shadow.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini + - ./index.php:/opt/www/index.php + - ./php.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini ui: image: skywalking/ui:latest diff --git a/test/e2e/e2e-test/docker/php/php-shadow.ini b/test/e2e/e2e-test/docker/php/php-shadow.ini index a2dd7c3c3f20..dbffe5ea37b9 100644 --- a/test/e2e/e2e-test/docker/php/php-shadow.ini +++ b/test/e2e/e2e-test/docker/php/php-shadow.ini @@ -1,17 +1,17 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +; Licensed to the Apache Software Foundation (ASF) under one or more +; contributor license agreements. See the NOTICE file distributed with +; this work for additional information regarding copyright ownership. +; The ASF licenses this file to You under the Apache License, Version 2.0 +; (the "License"); you may not use this file except in compliance with +; the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. [skywalking] extension=skywalking.so diff --git a/test/e2e/e2e-test/docker/php/php.ini b/test/e2e/e2e-test/docker/php/php.ini index c62b46916bec..52434c8ab4e1 100644 --- a/test/e2e/e2e-test/docker/php/php.ini +++ b/test/e2e/e2e-test/docker/php/php.ini @@ -1,17 +1,17 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +; Licensed to the Apache Software Foundation (ASF) under one or more +; contributor license agreements. See the NOTICE file distributed with +; this work for additional information regarding copyright ownership. +; The ASF licenses this file to You under the Apache License, Version 2.0 +; (the "License"); you may not use this file except in compliance with +; the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. [skywalking] extension=skywalking.so diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml b/test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml index 46ed6858b1ac..d9af02b59fd6 100644 --- a/test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml +++ b/test/e2e/e2e-test/src/test/resources/expected/php/shadowInstances.yml @@ -23,5 +23,5 @@ instances: value: not null - name: process_no value: gt 0 - - name: ipV4s + - name: ipv4s value: not null From bc9d59559e88a506958fcb284ce10084c0061540 Mon Sep 17 00:00:00 2001 From: heyanlong Date: Mon, 23 Mar 2020 13:56:28 +0800 Subject: [PATCH 5/8] Add PHP module support to e2e test --- test/e2e/e2e-test/docker/php/docker-compose.yml | 6 +++--- .../src/test/java/org/apache/skywalking/e2e/PHPE2E.java | 2 +- .../e2e-test/src/test/resources/expected/php/instances.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/e2e-test/docker/php/docker-compose.yml b/test/e2e/e2e-test/docker/php/docker-compose.yml index dd0f25bacc22..a09c701402c1 100644 --- a/test/e2e/e2e-test/docker/php/docker-compose.yml +++ b/test/e2e/e2e-test/docker/php/docker-compose.yml @@ -42,11 +42,11 @@ services: oap: condition: service_healthy volumes: - - ./index.php:/opt/www/index.php + - ./index.php:/var/www/html/index.php - ./php-shadow.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini php: - image: skyapm/skywalking-php:latest + image: skyapm/skywalking-php:v3.2.8 networks: - e2e expose: @@ -59,7 +59,7 @@ services: oap: condition: service_healthy volumes: - - ./index.php:/opt/www/index.php + - ./index.php:/var/www/html/index.php - ./php.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini ui: diff --git a/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/PHPE2E.java b/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/PHPE2E.java index 66a5264c3aa0..928504a3b966 100644 --- a/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/PHPE2E.java +++ b/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/PHPE2E.java @@ -218,7 +218,7 @@ private void verifyInstancesMetrics(Instances instances) throws Exception { private void verifyEndpointsMetrics(Endpoints endpoints) throws Exception { for (Endpoint endpoint : endpoints.getEndpoints()) { - if (!endpoint.getLabel().equals("/info") || !endpoint.getLabel().equals("/php/info")) { + if (!endpoint.getLabel().equals("/php/call") || !endpoint.getLabel().equals("/php/info")) { continue; } for (final String metricName : ALL_ENDPOINT_METRICS) { diff --git a/test/e2e/e2e-test/src/test/resources/expected/php/instances.yml b/test/e2e/e2e-test/src/test/resources/expected/php/instances.yml index 11a7aff14a69..83dbceee47ef 100644 --- a/test/e2e/e2e-test/src/test/resources/expected/php/instances.yml +++ b/test/e2e/e2e-test/src/test/resources/expected/php/instances.yml @@ -23,5 +23,5 @@ instances: value: not null - name: process_no value: gt 0 - - name: ipV4s + - name: ipv4s value: not null From 458978f2e5235f110984f2ecab76f05642fab874 Mon Sep 17 00:00:00 2001 From: heyanlong Date: Mon, 23 Mar 2020 14:03:18 +0800 Subject: [PATCH 6/8] Add e2e.php.yaml --- .github/workflows/e2e.php.yaml | 52 ++++++++++++++++++++++++++++++++++ .github/workflows/e2e.yaml | 22 -------------- 2 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/e2e.php.yaml diff --git a/.github/workflows/e2e.php.yaml b/.github/workflows/e2e.php.yaml new file mode 100644 index 000000000000..383cad82cdce --- /dev/null +++ b/.github/workflows/e2e.php.yaml @@ -0,0 +1,52 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: E2E + +on: + pull_request: + push: + branches: + - master + tags: + - 'v*' + +env: + SKIP_TEST: true + SW_AGENT_JDK_VERSION: 8 + +jobs: + PHPAgent: + name: PHP + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: checkout submodules + shell: bash + run: | + git submodule sync --recursive + git -c protocol.version=2 submodule update --init --force --recursive --depth=1 + - name: Compile and Build + run: make docker + - name: Copy dist package + run: cp -R dist test/e2e/ + - name: PHP + run: ./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.PHPE2E + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: logs + path: logs diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 4c563f7907fe..8ee9d812d453 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -80,28 +80,6 @@ jobs: name: logs path: logs - FeatureGroup03: - name: PHP - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: checkout submodules - shell: bash - run: | - git submodule sync --recursive - git -c protocol.version=2 submodule update --init --force --recursive --depth=1 - - name: Compile and Build - run: make docker - - name: Copy dist package - run: cp -R dist test/e2e/ - - name: PHP - run: ./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.PHPE2E - - uses: actions/upload-artifact@v1 - if: failure() - with: - name: logs - path: logs - Gateway: name: Gateway runs-on: ubuntu-latest From 1411ec0cbccef81e88937833567b387d284b3579 Mon Sep 17 00:00:00 2001 From: heyanlong Date: Mon, 23 Mar 2020 22:12:08 +0800 Subject: [PATCH 7/8] Locked version --- test/e2e/e2e-test/docker/php/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/e2e-test/docker/php/docker-compose.yml b/test/e2e/e2e-test/docker/php/docker-compose.yml index a09c701402c1..8b8bd388fe62 100644 --- a/test/e2e/e2e-test/docker/php/docker-compose.yml +++ b/test/e2e/e2e-test/docker/php/docker-compose.yml @@ -31,7 +31,7 @@ services: retries: 120 php-shadow: - image: skyapm/skywalking-php:latest + image: skyapm/skywalking-php:v3.2.8 networks: - e2e expose: From 6cb19e34c3354aeebca75cffc9320ff014fe6ada Mon Sep 17 00:00:00 2001 From: heyanlong Date: Sat, 28 Mar 2020 08:20:43 +0800 Subject: [PATCH 8/8] Add 200000 microsecond sleep in E2E-PHP --- test/e2e/e2e-test/docker/php/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/e2e/e2e-test/docker/php/index.php b/test/e2e/e2e-test/docker/php/index.php index 330e60fdf285..604fbae62462 100644 --- a/test/e2e/e2e-test/docker/php/index.php +++ b/test/e2e/e2e-test/docker/php/index.php @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +usleep(200000); $uri = $_SERVER['REQUEST_URI']; if($uri == '/php/info') {