You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2019/11/11 04:16:53 UTC

[skywalking] 01/01: Test

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

hanahmily pushed a commit to branch minikube
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 3a1a35058fc441ccca71a82f534edaefb148203d
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Mon Nov 11 12:15:50 2019 +0800

    Test
---
 Jenkinsfile-E2E-Mesh                               |  36 +++++++
 .../server-starter/src/main/resources/log4j2.xml   |   2 +-
 skywalking-ui                                      |   2 +-
 test/e2e-kubernetes/istio-mixer-adapter/run.sh     |  50 +++++++++
 test/scripts/clean.sh                              |  28 +++++
 test/scripts/minikube.sh                           | 114 +++++++++++++++++++++
 test/scripts/pre.sh                                |  80 +++++++++++++++
 7 files changed, 310 insertions(+), 2 deletions(-)

diff --git a/Jenkinsfile-E2E-Mesh b/Jenkinsfile-E2E-Mesh
new file mode 100644
index 0000000..496df1b
--- /dev/null
+++ b/Jenkinsfile-E2E-Mesh
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ *
+ */
+
+pipeline {
+    agent {
+        label 'jenkins-skywalking5'
+    }
+
+    options {
+        timestamps()
+        timeout(time: 5, unit: 'HOURS')
+    }
+
+    stages {
+        stage('Test') {
+            steps {
+                sh 'whoami'
+                sh 'sudo ls -lt /root'
+            }
+        }
+}
diff --git a/oap-server/server-starter/src/main/resources/log4j2.xml b/oap-server/server-starter/src/main/resources/log4j2.xml
index 72dcf43..fc300a2 100644
--- a/oap-server/server-starter/src/main/resources/log4j2.xml
+++ b/oap-server/server-starter/src/main/resources/log4j2.xml
@@ -35,7 +35,7 @@
         <logger name="org.apache.skywalking.oap.server.core" level="INFO"/>
         <logger name="org.apache.skywalking.oap.server.core.remote.client" level="DEBUG"/>
         <logger name="org.apache.skywalking.oap.server.library.buffer" level="INFO"/>
-        <logger name="org.apache.skywalking.oap.server.receiver.so11y" level="DEBUG" />
+<!--        <logger name="org.apache.skywalking.oap.server.receiver.so11y" level="DEBUG" />-->
         <Root level="DEBUG">
             <AppenderRef ref="Console"/>
         </Root>
diff --git a/skywalking-ui b/skywalking-ui
index 2695697..9f3aa72 160000
--- a/skywalking-ui
+++ b/skywalking-ui
@@ -1 +1 @@
-Subproject commit 2695697d0de0acf4f5adc0df68e7d71a4824b4e4
+Subproject commit 9f3aa72a47983c037e95fb3607faa2154bafef59
diff --git a/test/e2e-kubernetes/istio-mixer-adapter/run.sh b/test/e2e-kubernetes/istio-mixer-adapter/run.sh
new file mode 100755
index 0000000..400a842
--- /dev/null
+++ b/test/e2e-kubernetes/istio-mixer-adapter/run.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+
+set -ex
+
+DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+ROOT=${DIR}/../../..
+SCRIPTS_DIR=${ROOT}/test/scripts
+
+CONTAINER_NAME=$1
+if [[ "${CONTAINER_NAME}" == "" ]]; then
+    CONTAINER_NAME="e2e-istio-mixer-adapter"
+fi
+
+# Clean old container
+${SCRIPTS_DIR}/clean.sh ${CONTAINER_NAME}
+
+
+docker run -itd --name ${CONTAINER_NAME} -v ${ROOT}:/skywalking buildpack-deps:16.04-curl /bin/bash
+
+CONTAINER_SCRIPTS_DIR=/skywalking/test/scripts
+
+# Install all requirements
+docker exec -it ${CONTAINER_NAME} ${CONTAINER_SCRIPTS_DIR}/pre.sh
+
+docker exec -it ${CONTAINER_NAME} ${CONTAINER_SCRIPTS_DIR}/minikube.sh startMinikube &
+
+docker exec -it ${CONTAINER_NAME} ${CONTAINER_SCRIPTS_DIR}/minikube.sh waitMinikube
+
+docker exec -it ${CONTAINER_NAME} ${CONTAINER_SCRIPTS_DIR}/minikube.sh stopMinikube
+
+${SCRIPTS_DIR}/clean.sh ${CONTAINER_NAME}
diff --git a/test/scripts/clean.sh b/test/scripts/clean.sh
new file mode 100755
index 0000000..9de476b
--- /dev/null
+++ b/test/scripts/clean.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+
+set -e
+
+CONTAINER_NAME=$1
+[[ "${CONTAINER_NAME}" == "" ]] && exit 1
+
+docker ps | grep -e ${CONTAINER_NAME} | awk '{print $1}' | xargs docker stop
+docker ps -a | grep -e ${CONTAINER_NAME} | awk '{print $1}' | xargs docker rm
diff --git a/test/scripts/minikube.sh b/test/scripts/minikube.sh
new file mode 100755
index 0000000..be2924b
--- /dev/null
+++ b/test/scripts/minikube.sh
@@ -0,0 +1,114 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+
+set -x
+
+K8S_VER=$2
+if [[ "${K8S_VER}" == "" ]]; then
+    K8S_VER="k8s-v1.15.4"
+fi
+
+function waitMinikube() {
+  set +e
+  kubectl cluster-info
+  # This for loop waits until kubectl can access the api server that Minikube has created.
+  for _ in {1..12}; do # Timeout for 120 seconds.
+    kubectl get po --all-namespaces
+    if [ $? -ne 1 ]; then
+      break
+    fi
+    sleep 10
+  done
+  if ! kubectl get all --all-namespaces; then
+    echo "Kubernetes failed to start"
+    ps ax
+    netstat -an
+    docker images
+    cat /var/lib/localkube/localkube.err
+    printf '\n\n\n'
+    kubectl cluster-info dump
+    exit 1
+  fi
+
+  echo "Minikube is running"
+
+  for _ in {1..6}; do # Timeout for 60 seconds.
+    echo "$(sudo -E minikube ip) minikube.local" | sudo tee -a /etc/hosts
+    ip=$(cat /etc/hosts | grep minikube.local | cut -d' ' -f1 | xargs)
+    if [ -n "$ip" ]; then
+      break
+    fi
+    sleep 10
+  done
+
+  ip=$(cat /etc/hosts | grep minikube.local | cut -d' ' -f1 | xargs)
+  if [ -n "$ip" ]; then
+    echo "minikube.local is mapped to $ip"
+  else
+    exit 1
+  fi
+}
+
+# startMinikubeNone starts real kubernetes minikube with none driver. This requires `sudo`.
+function startMinikubeNone() {
+  export MINIKUBE_WANTUPDATENOTIFICATION=false
+  export MINIKUBE_WANTREPORTERRORPROMPT=false
+  export MINIKUBE_HOME=$HOME
+  export CHANGE_MINIKUBE_NONE_USER=true
+
+  # Troubleshoot problem with Docker build on some CircleCI machines.
+  if [ -f /proc/sys/net/ipv4/ip_forward ]; then
+    echo "IP forwarding setting: $(cat /proc/sys/net/ipv4/ip_forward)"
+    echo "My hostname is:"
+    hostname
+    echo "My distro is:"
+    cat /etc/*-release
+    echo "Contents of /etc/sysctl.d/"
+    ls -l /etc/sysctl.d/ || true
+    echo "Contents of /etc/sysctl.conf"
+    grep ip_forward /etc/sysctl.conf
+    echo "Config files setting ip_forward"
+    find /etc/sysctl.d/ -type f -exec grep ip_forward \{\} \; -print
+    if [ "$(cat /proc/sys/net/ipv4/ip_forward)" -eq 0 ]; then
+      whoami
+      echo "Cannot build images without IPv4 forwarding, attempting to turn on forwarding"
+      sudo sysctl -w net.ipv4.ip_forward=1
+      if [ "$(cat /proc/sys/net/ipv4/ip_forward)" -eq 0 ]; then
+        echo "Cannot build images without IPv4 forwarding"
+        exit 1
+      fi
+    fi
+  fi
+
+  sudo -E minikube config set WantUpdateNotification false
+  sudo -E minikube config set WantReportErrorPrompt false
+  sudo -E minikube start --kubernetes-version=${K8S_VER#k8s-} --vm-driver=none
+}
+
+function stopMinikube() {
+  sudo minikube stop
+}
+
+case "$1" in
+  start) startMinikubeNone ;;
+  stop) stopMinikube ;;
+  wait) waitMinikube ;;
+esac
\ No newline at end of file
diff --git a/test/scripts/pre.sh b/test/scripts/pre.sh
new file mode 100755
index 0000000..d4e4935
--- /dev/null
+++ b/test/scripts/pre.sh
@@ -0,0 +1,80 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+
+set -ex
+
+apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*
+
+HELMVERSION=$1
+if [[ "${HELMVERSION}" == "" ]]; then
+    HELMVERSION="helm-v3.0.0-rc.3"
+fi
+
+MINIKUBEVERESION=$2
+if [[ "${MINIKUBEVERESION}" == "" ]]; then
+    MINIKUBEVERESION="minikube-v1.4.0"
+fi
+
+K8SVERSION=$3
+if [[ "${K8SVERSION}" == "" ]]; then
+    K8SVERSION="k8s-v1.15.4"
+fi
+
+# Remove strict host checking. The rest of the file is already populated by the 'add_ssh_keys' step.
+mkdir -p ~/.ssh
+echo -e "\tStrictHostKeyChecking no" >> ~/.ssh/config
+echo -e "\tControlMaster auto" >> ~/.ssh/config
+echo -e "\tControlPersist 3600" >> ~/.ssh/config
+echo -e "\tControlPath ~/.ssh/%r@%h:%p" >> ~/.ssh/config
+
+# Create directory for logs.
+mkdir -p ~/logs
+
+# create directory for e2e artifacts.
+mkdir -p ~/skywalking/test/e2e/artifacts
+
+curl -sSL https://get.helm.sh/${HELMVERSION}-linux-amd64.tar.gz | \
+    sudo tar xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
+
+sudo mkdir -p /usr/local/bin
+curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBEVERESION#minikube-}/minikube-linux-amd64" -o /tmp/minikube
+chmod +x /tmp/minikube
+sudo mv /tmp/minikube /usr/local/bin/minikube
+
+curl -sSL "https://storage.googleapis.com/kubernetes-release/release/${K8SVERSION#k8s-}/bin/linux/amd64/kubectl" -o /tmp/kubectl
+chmod +x /tmp/kubectl
+sudo mv /tmp/kubectl /usr/local/bin/kubectl
+
+sudo apt-get remove -y --purge man-db
+sudo apt-get update
+sudo apt-get install -y \
+    --no-install-recommends --allow-downgrades --allow-remove-essential --allow-change-held-packages \
+    xvfb libgtk-3-0 libnotify4 libgconf-2-4 libnss3 libxss1 libasound2 \
+    apt-transport-https systemd \
+    software-properties-common
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+sudo apt-key fingerprint 0EBFCD88
+sudo add-apt-repository \
+   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+   $(lsb_release -cs) \
+   stable"
+sudo apt-get update
+sudo apt-get install -y docker-ce
\ No newline at end of file