This is an automated email from the ASF dual-hosted git repository. csantanapr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push: new 4cb1386 Remove old scripts and unused config parameters (#2564) 4cb1386 is described below commit 4cb13866f7923983707f48f4ad6e1d1a50232dcf Author: rodric rabbah <rod...@gmail.com> AuthorDate: Thu Aug 3 15:36:30 2017 -0400 Remove old scripts and unused config parameters (#2564) * Remove deadcode. * Remove some dead config parameters. * Remove useless test suite - all of these are already checked during deployment. What are we gaining with these tests? * Remove now unused scripts. * Remove isAlive from flake8. * Remove tools/logs unused. --- ansible/templates/whisk.properties.j2 | 2 - .../src/main/scala/whisk/core/WhiskConfig.scala | 4 - tests/src/test/scala/common/WhiskProperties.java | 4 - tests/src/test/scala/services/PingTests.scala | 129 -------------------- tools/docker/cleanAllDockers.sh | 37 ------ tools/docker/cleanDocker.sh | 77 ------------ tools/docker/listAllDockerHosts.sh | 31 ----- tools/health/isAlive | 130 --------------------- tools/health/killComponent | 81 ------------- tools/health/monitorUtil.py | 77 ------------ tools/logs/copyLogs.sh | 11 -- tools/logs/logdiff.sh | 30 ----- tools/travis/flake8.sh | 5 +- 13 files changed, 1 insertion(+), 617 deletions(-) diff --git a/ansible/templates/whisk.properties.j2 b/ansible/templates/whisk.properties.j2 index af5f908..1543f70 100644 --- a/ansible/templates/whisk.properties.j2 +++ b/ansible/templates/whisk.properties.j2 @@ -74,8 +74,6 @@ invoker.useRunc={{ invoker_use_runc | default(invoker.useRunc) }} invoker.useReactivePool={{ invoker.useReactivePool }} invoker.instances={{ invoker.instances }} -edge.docker.endpoint={{ groups["edge"]|first }}:{{ docker.port }} -kafka.docker.endpoint={{ groups["kafka"]|first }}:{{ docker.port }} main.docker.endpoint={{ groups["controllers"]|first }}:{{ docker.port }} docker.registry={{ docker_registry }} diff --git a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala index 8bbe0b4..1f3bbee 100644 --- a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala +++ b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala @@ -97,8 +97,6 @@ class WhiskConfig( val dbActivations = this(WhiskConfig.dbActivations) val dbPrefix = this(WhiskConfig.dbPrefix) - val edgeDockerEndpoint = this(WhiskConfig.edgeDockerEndpoint) - val kafkaDockerEndpoint = this(WhiskConfig.kafkaDockerEndpoint) val mainDockerEndpoint = this(WhiskConfig.mainDockerEndpoint) val runtimesManifest = this(WhiskConfig.runtimesManifest) @@ -206,8 +204,6 @@ object WhiskConfig { val wskApiHostname = "whisk.api.host.name" val wskApiHost = Map(wskApiProtocol -> "https", wskApiPort -> 443.toString, wskApiHostname -> null) - val edgeDockerEndpoint = "edge.docker.endpoint" - val kafkaDockerEndpoint = "kafka.docker.endpoint" val mainDockerEndpoint = "main.docker.endpoint" private val controllerBlackboxFraction = "controller.blackboxFraction" diff --git a/tests/src/test/scala/common/WhiskProperties.java b/tests/src/test/scala/common/WhiskProperties.java index 32ab0b0..c713d43 100644 --- a/tests/src/test/scala/common/WhiskProperties.java +++ b/tests/src/test/scala/common/WhiskProperties.java @@ -156,10 +156,6 @@ public class WhiskProperties { return whiskProperties.getProperty("main.docker.endpoint"); } - public static String getKafkaDockerEndpoint() { - return whiskProperties.getProperty("kafka.docker.endpoint"); - } - public static boolean useCLIDownload() { return whiskProperties.getProperty("use.cli.download").equals("true"); } diff --git a/tests/src/test/scala/services/PingTests.scala b/tests/src/test/scala/services/PingTests.scala deleted file mode 100644 index 72d840d..0000000 --- a/tests/src/test/scala/services/PingTests.scala +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ - -package services - -import java.io.File - -import scala.concurrent.Await -import scala.concurrent.ExecutionContext -import scala.concurrent.duration.DurationInt -import scala.util.Try - -import org.junit.Assert.assertTrue -import org.junit.runner.RunWith -import org.scalatest.FlatSpec -import org.scalatest.Matchers -import org.scalatest.concurrent.ScalaFutures -import org.scalatest.junit.JUnitRunner - -import com.jayway.restassured.RestAssured - -import akka.actor.ActorSystem -import akka.http.scaladsl.Http -import akka.http.scaladsl.model.HttpRequest -import akka.http.scaladsl.unmarshalling.Unmarshal -import akka.stream.ActorMaterializer -import akka.stream.Materializer -import common.TestUtils -import common.TestUtils.RunResult -import common.WhiskProperties -import common.WskActorSystem -import common.WskTestHelpers -import akka.http.scaladsl.model.StatusCodes - -/** - * Basic tests to check that a Whisk installation is healthy in that all - * components respond to a heartbeat ping - */ -object PingTests { - val bin: File = WhiskProperties.getFileRelativeToWhiskHome("tools/health") - - def isAliveScript(name: String, whiskPropertyFile: String): RunResult = { - TestUtils.runCmd(TestUtils.SUCCESS_EXIT, bin, WhiskProperties.python, "isAlive", "-d", whiskPropertyFile, "--wait", "30", name) - } - - def ping(host: String, port: Int)(implicit actorSystem: ActorSystem, ec: ExecutionContext, materializer: Materializer) = { - val response = Try { Await.result(Http().singleRequest(HttpRequest(uri = s"http://$host:$port/ping")), 10.seconds) }.toOption - - response.map { res => - (res.status, Await.result(Unmarshal(res).to[String], 10.seconds)) - } - } -} - -@RunWith(classOf[JUnitRunner]) -class PingTests extends FlatSpec - with Matchers - with WskTestHelpers - with ScalaFutures - with WskActorSystem { - - implicit val materializer = ActorMaterializer() - - /** - * Check that the docker REST interface at endpoint is up. envVar is the - * environment variable from which we obtain. - */ - def pingDocker(envVar: String, endpoint: String): Unit = { - assertTrue(envVar + " not set", endpoint != null) - assertTrue(envVar + " not set", endpoint.length > 0) - - val response: String = RestAssured.given.port(4243).baseUri("http://" + endpoint).get("/info").body.asString - println("GET /info") - println(response) - assertTrue(response.contains("Containers")) - } - - behavior of "PingTest" - - it should "check that the main docker endpoint is functioning" in { - pingDocker("main.docker.endpoint", WhiskProperties.getMainDockerEndpoint) - } - - it should "Check the kafka docker endpoint is functioning" in { - pingDocker("kafka.docker.endpoint", WhiskProperties.getKafkaDockerEndpoint) - } - - it should "check that the zookeeper endpoint is up and running" in { - PingTests.isAliveScript("zookeeper", WhiskProperties.getFileRelativeToWhiskHome(".").getAbsolutePath) - } - - it should "Check that the invoker endpoints are up and running" in { - val basePort = WhiskProperties.getProperty("invoker.hosts.baseport").toInt - val invokers = WhiskProperties.getInvokerHosts.zipWithIndex.map { - case (invoker, instance) => - val res = PingTests.ping(invoker, basePort + instance) - - res shouldBe defined - res.get._1 shouldBe StatusCodes.OK - res.get._2 shouldBe "pong" - } - } - - it should "check that the controller endpoint is up and running" in { - val basePort = WhiskProperties.getControllerBasePort() - val controllers = WhiskProperties.getControllerHosts().split(",").zipWithIndex.map { - case (controller, instance) => - val res = PingTests.ping(controller, basePort + instance) - - res shouldBe defined - res.get._1 shouldBe StatusCodes.OK - res.get._2 shouldBe "pong" - } - } -} diff --git a/tools/docker/cleanAllDockers.sh b/tools/docker/cleanAllDockers.sh deleted file mode 100755 index 4a19fcf..0000000 --- a/tools/docker/cleanAllDockers.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/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. -# - -SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)" -WHISKPROPS=$1 -: ${WHISKPROPS:?"WHISKPROPS must be set and non-empty"} - -DATABASE_EXEMPT=$2 - -# -# run cleanDocker.sh on each docker endpoint -# -ALL_HOSTS=`"$SCRIPTDIR/listAllDockerHosts.sh" "$WHISKPROPS"` -DEFAULT_DOCKER_PORT=4243 - -for h in $ALL_HOSTS -do - echo "Cleaning docker at $h:${DOCKER_PORT:-$DEFAULT_DOCKER_PORT}" - DOCKER_ENDPOINT=$h:${DOCKER_PORT:-$DEFAULT_DOCKER_PORT} "$SCRIPTDIR/cleanDocker.sh" "$DATABASE_EXEMPT" & -done -wait diff --git a/tools/docker/cleanDocker.sh b/tools/docker/cleanDocker.sh deleted file mode 100755 index e7f583c..0000000 --- a/tools/docker/cleanDocker.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/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. -# - -DATABASE_EXEMPT=$1 - -# Kill all running containers and remove all dangling (non-leaf) images -# Add "--purge" to remove all images -if [ -n "${DOCKER_ENDPOINT+1}" ]; then - DOCKER="docker --host tcp://$DOCKER_ENDPOINT" -else - DOCKER="docker" -fi -if [ -n $DOCKER_TLS_CMD ]; then - DOCKER="$DOCKER $DOCKER_TLS_CMD" -fi - -# First stop and rm all containers before dealing with images. -# -# We are using kill instead of stop deliberately, since stop is too slow -# during development. Unfriendly? Too bad. -# -# Container exempted from death: -# whisk_docker_registry -# whiskrouter -# *catalog* -# *swarm* -# - -if [ "$DATABASE_EXEMPT" == "couchdb" ]; -then - RUNNING=$($DOCKER ps -a | fgrep -v "whisk_docker_registry" | fgrep -v "whiskrouter" | fgrep -v "catalog" | fgrep -v "swarm" | fgrep -v "couchdb" | sed '1d' | awk '{print $1}') -else - RUNNING=$($DOCKER ps -a | fgrep -v "whisk_docker_registry" | fgrep -v "whiskrouter" | fgrep -v "catalog" | fgrep -v "swarm" | sed '1d' | awk '{print $1}') -fi - -if [ -n "$RUNNING" ] -then - $DOCKER unpause $RUNNING > /dev/null - $DOCKER kill $RUNNING - $DOCKER rm -f -v $RUNNING -fi - -# Dangling means non-leaf/intermediates images created during construction -DANGLING=$($DOCKER images -q -f dangling=true) -if [ -n "$DANGLING" ] -then - $DOCKER rmi -f $DANGLING -fi - -# remove all images tagged with the string :5000/whisk for pushing to local docker registry. This excludes the catalog images -#TAGGED=$($DOCKER images | fgrep ":5000/whisk" | awk '{print $3}') -#if [ -n "$TAGGED" ] -#then -# $DOCKER rmi -f $TAGGED -#fi - -ALL=$($DOCKER images -q) -if [[ "$1" = "--purge" && -n "$ALL" ]] ; then - $DOCKER rmi $ALL -fi - diff --git a/tools/docker/listAllDockerHosts.sh b/tools/docker/listAllDockerHosts.sh deleted file mode 100755 index e100a93..0000000 --- a/tools/docker/listAllDockerHosts.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/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. -# - -WHISKPROPS=$1 -: ${WHISKPROPS:?"WHISKPROPS must be set and non-empty"} - -DOCKER_ENDPOINTS=`cat "$WHISKPROPS" | egrep "docker.endpoint" | sed -e "s/.*=//" | sed -e "s/:.*//" | sort | uniq` -INVOKERS_ONE_LINE=`cat "$WHISKPROPS" | egrep "invoker.hosts=" | sed -e "s/.*=//" | sed -e "s/:.*//"` -INVOKERS=(${INVOKERS_ONE_LINE//,/\\n}) -ADDITIONAL_ONE_LINE=`cat "$WHISKPROPS" | egrep "additional.hosts=" | sed -e "s/.*=//" | sed -e "s/:.*//"` -ADDITIONAL=(${ADDITIONAL_ONE_LINE//,/\\n}) - -HOSTS_UNIQUE=`printf "$INVOKERS\n$DOCKER_ENDPOINTS\n$ADDITIONAL" | sort | uniq` - -printf "$HOSTS_UNIQUE\n" diff --git a/tools/health/isAlive b/tools/health/isAlive deleted file mode 100755 index cd445c9..0000000 --- a/tools/health/isAlive +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python - -# -# 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. -# - -# Determine if some component of wsk is alive -# Returns 0 if it is up and otherwise the last error code from the service. - -import os -import sys -import argparse -import monitorUtil - -# wskprop is in the sibling directory -scriptDir = sys.path[0] -rootDir = os.path.dirname(os.path.dirname(scriptDir)) -cliDir = os.path.join(rootDir, "tools", "admin") -sys.path.insert(1, cliDir) - -import wskprop - -def getProp(key) : - try: - return whiskprops[key] - except KeyError: - print('Could not find %s' % key) - return False - -def getHostWithPort(hostComp, portComp, failIfNotFound = True): - host = getProp(hostComp.upper()+'_HOST') - tmp = getProp(portComp.upper()+'_HOST_PORT') - port = tmp if type(host) is str and ':' not in host else '' - if host != False and port != False: - return (host + ':' + port) if (port != '') else host - elif failIfNotFound: - print("Unknown component {0}".format(hostComp)) - exit(-1) - else: - return False - return host + ':' + port - -def getInvokerHostAndPort(component, host = None, failIfNotFound = True): - comp = component.upper() - instance = int(comp[7:]) - if (host == None): - hosts = getProp('INVOKER_HOSTS').split(',') - host = hosts[instance] - port = str(int(getProp('INVOKER_HOSTS_BASEPORT'))+instance) - print(host + ':' + port) - return host + ':' + port - -def getHostAndPort(component, host = None, failIfNotFound = True): - if (component.upper().find("INVOKER") == 0): - return getInvokerHostAndPort(component, host, failIfNotFound) - return getHostWithPort(component, component, failIfNotFound) - -def ping(host_port) : - cmd = ['curl', '-m', '3', '-s', '-X', 'GET', '%s/ping' % host_port] - okString = 'pong' - return monitorUtil.outputChecker(cmd, okString, 1) - -def isDockerRegistryAlive() : - host = getProp('WHISK_DOCKER_REGISTRY') - cmd = ['curl', '-m', '3', '-s', '-X', 'GET', '%s:5000/v2/' % host] - okString = '{}' - return monitorUtil.outputChecker(cmd, okString, 1) - -def isElkAlive() : - host_port = getHostAndPort('elk') - cmd = ['curl', '-s', '-S', '-m', '3', '%s' % host_port ] - okString = '"cluster_name"' - return monitorUtil.outputChecker(cmd, okString, 1) - -def isZookeeperAlive() : - host_port = getHostAndPort('zookeeper').split(':') - cmd = '(echo ruok; sleep 1) | nc '+ host_port[0] + ' '+ host_port[1] - okString = 'imok' - (rc, output) = monitorUtil.run(cmd, 'ruok', True) - if (rc != 0): - print('isZooKeeperAlive: still waiting for zookeeper (nc failed with ' - '%d: %s)' % (rc, output)) - return rc - if (output == okString): - return 0 - else: - print('isZooKeeperAlive: Unexpected output string to imok query %s' - % output) - return -2 - -parser = argparse.ArgumentParser(description='Check if a whisk component is alive or wait until it is.') -parser.add_argument('component', help='check if the given component is alive: elk') -parser.add_argument('--wait', help='check for this many seconds') -parser.add_argument('--host', help='check for component at this host') -parser.add_argument('-d','--dir', help='directory for whisk.properties') -args = parser.parse_args() - -if (args.dir is None): - print('Must specify directory with -d') - exit(-1) - -whiskprops = wskprop.importPropsIfAvailable(wskprop.propfile(args.dir)) - -if (args.wait is None): - delay = 0 -else: - delay = int(args.wait) - -if (args.component == 'docker.registry'): - monitorUtil.checkLoop(args.component, isDockerRegistryAlive, delay) -elif (args.component == 'elk'): - monitorUtil.checkLoop(args.component, isElkAlive, delay) -elif (args.component == 'zookeeper'): - monitorUtil.checkLoop(args.component, isZookeeperAlive, delay) -else: - host_port = getHostAndPort(args.component, args.host) - monitorUtil.checkLoop(args.component, lambda : ping(host_port), delay) diff --git a/tools/health/killComponent b/tools/health/killComponent deleted file mode 100755 index d9e23f4..0000000 --- a/tools/health/killComponent +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python - -# -# 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. -# - -# Kill some component of wsk by stopping its docker container -# Returns 0 if it is up and otherwise the last error code from the service. - -import os -import sys -import argparse - -scriptDir = sys.path[0] -rootDir = os.path.dirname(os.path.dirname(scriptDir)) -cliDir = os.path.join(rootDir, "tools", "admin") -sys.path.insert(1, cliDir) - -healthDir = os.path.join(os.path.join(rootDir, "tools"), "health") -sys.path.insert(1, healthDir) - -import wskprop -import monitorUtil - -whiskprops = wskprop.importPropsIfAvailable(wskprop.propfile(scriptDir)) - -parser = argparse.ArgumentParser(description='Kill some whisk component by stopping its container.') -parser.add_argument('component', help='name of component to kill: elk, kafka, ...') -args = parser.parse_args() -component = args.component - -componentToDocker = { 'elk' : 'ELK_DOCKER_ENDPOINT', - 'kafka' : 'KAFKA_DOCKER_ENDPOINT', - 'zookeeper' : 'KAFKA_DOCKER_ENDPOINT', - 'loadbalancer' : 'MAIN_DOCKER_ENDPOINT', - 'controller' : 'MAIN_DOCKER_ENDPOINT', - 'invokers' : 'INVOKER_HOSTS', - 'cloudanttrigger' : 'CATALOG_DOCKER_ENDPOINT' - } - -isInvoker = component.find('invoker') == 0 -invokerCount = int(component[7:]) if isInvoker else -1 # 0-based - -try: - docker = componentToDocker['invokers' if isInvoker else component] -except KeyError: - print("Unknown component:", component) - exit(-1) - -try: - dockerEndpoint = whiskprops[docker] - if (isInvoker): - dockerEndpoint = dockerEndpoint.split(',')[invokerCount] + ':4243' -except KeyError: - print('Could not locate docker endpoint ', docker) - exit(-2) - -print("component = ", component) -print("docker = ", docker) -print("dockerEndpoint = ", dockerEndpoint) - -(rc,output) = monitorUtil.run(["docker", "--host", dockerEndpoint, "stop", component]) -if (rc == 0): - print("Stopped container for component ", component) - exit(0) -else: - print(output) - exit(rc) diff --git a/tools/health/monitorUtil.py b/tools/health/monitorUtil.py deleted file mode 100755 index 07484a1..0000000 --- a/tools/health/monitorUtil.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -"""Utility for health/RAS. - -/* - * 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. - */ -""" -from __future__ import print_function -import sys -import subprocess -import datetime -import time - - -# Repeatedly run the check for delay seconds until it responds with a 0. -# If it never does, exit with the last failing code rather than 0. -def checkLoop(name, checker, delay): - now = datetime.datetime.now() - end = now + datetime.timedelta(0, delay) - while (now <= end): - now = datetime.datetime.now() - alive = checker() - if (alive == 0): - break - if (delay != 0): - time.sleep(3) - print("%s %s" % (name, "is alive" if alive == 0 else "is not responding")) - sys.exit(alive) - - -# Runs the given command with optional input. -# The command is run in a blocking fashion and the return code -# and output (both stdout/stderr combined) returned as a pair. -def run(cmd, inData="", isShell=False): - try: - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, - shell=isShell, - stdin=subprocess.PIPE, - stderr=subprocess.STDOUT) - if (inData != ""): - p.stdin.write(inData) - (output, err) = p.communicate() - if (err != None): - return (-1, str(err)) - rc = p.returncode - except Exception as e: - print("exec: died with exception ", end="") - print(e) - print(" : ", cmd) - return (-1, str(e)) - return (rc, output) - - -# Run a given command and check its output - return 0 if it matches. -def outputChecker(cmd, expected, substring=0): - (rc, output) = run(cmd) - if (rc != 0): - return rc - match = ((output == expected) if (substring == 0) else - (output.find(expected) != -1)) - if (match): - return rc - else: - return -1 diff --git a/tools/logs/copyLogs.sh b/tools/logs/copyLogs.sh deleted file mode 100755 index c312c5e..0000000 --- a/tools/logs/copyLogs.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Usage copyLogs.sh <whisk.home> -# - -WHISK_HOME=$1 -: ${WHISK_HOME:?"WHISK_HOME must be set and non-empty"} -: ${WHISK_LOGS_DIR:?"WHISK_LOGS_DIR must be set and non-empty"} -LOGDIR=$WHISK_HOME/logs - -cp -r $WHISK_LOGS_DIR/* $LOGDIR diff --git a/tools/logs/logdiff.sh b/tools/logs/logdiff.sh deleted file mode 100755 index aac887a..0000000 --- a/tools/logs/logdiff.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# Usage logdiff.sh <logfile> -# Makes two logfiles comparable by replacing all ever-changing data like activation ids, timestamps etc. -# Usually used in this way: -# -# 1. Run first test, e.g. ./gradlew tests:test -# 2. Copy out logs using wskadmin db get whisks --docs --view whisks/activations > db-activations-first.log -# 3. Make some code changes -# 4. Re-deploy new code (clean, build, deploy) -# 5. Run second test, e.g. ./gradlew tests:test -# 6. Copy out logs using wskadmin db get whisks --docs --view whisks/activations > db-activations-second.log -# 7. logdiff.sh db-activations-first.log > db-activations-first-normalized.log -# 8. logdiff.sh db-activations-second.log > db-activations-second-normalized.log -# 9. diff db-activations-first-normalized.log db-activations-second-normalized.log -# -# The resulting diff should only show relevant differences between two log files of two test runs. -# - -LOGFILE=$1 -: ${LOGFILE:?"LOGFILE must be set and non-empty"} - -# replace uuids like activation ids -sed -e 's/[0-9A-Fa-f]\{32\}/<uuid>/g' $LOGFILE | -# replace msec timestamps -sed -e 's/[0-9]\{13,\}/<timestamp>/g' | -# replace UTC format timestamps -sed -e 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\.[0-9]\{1,\}Z/<UTC timestamp>/g' | -# replace javascript new Date().toString()-like timestamps -sed -E -e 's/(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]+ [0-9]+:[0-9]+:[0-9]+ [A-Za-z]* [0-9]+/<English date string>/g' diff --git a/tools/travis/flake8.sh b/tools/travis/flake8.sh index 05a7ad1..1c7260c 100755 --- a/tools/travis/flake8.sh +++ b/tools/travis/flake8.sh @@ -6,10 +6,7 @@ pip3 install --user --upgrade flake8 declare -a PYTHON_FILES=("." "./tools/admin/wskadmin" "./tools/build/citool" - "./tools/build/redo" - "./tools/health/isAlive" - "./tools/health/killComponent" - "./tools/health/kvstore") + "./tools/build/redo") echo 'Flake8: first round (fast fail) stops the build if there are any Python 3 syntax errors...' for i in "${PYTHON_FILES[@]}" -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].