rabbah closed pull request #46: Remove old cram tests URL: https://github.com/apache/incubator-openwhisk-runtime-go/pull/46
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index 4499418..0000000 --- a/test/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -action/ -*.json -*.err - diff --git a/test/NOTES.md b/test/NOTES.md deleted file mode 100644 index 4d57316..0000000 --- a/test/NOTES.md +++ /dev/null @@ -1,39 +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. -# ---> - -This is an optional command line test kit. - -It has been superseded by a go test suite and scalatests, -but it is still around for debugging. - - -TO use it: -- you need to install cram to use it and build images -- you can run them with `cram test_actionloop.t` -- and `cram test_actionloop-golang` - -also you can start directly the binary without the images with - -- `./start.sh` -- or `COMPILER=../common/gobuild.sh ./start.sh` - -If you start them, images won't be started by the test. - - - diff --git a/test/bin/.gitignore b/test/bin/.gitignore deleted file mode 100644 index b374f99..0000000 --- a/test/bin/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -hello_* -empty -hi diff --git a/test/bin/build.sh b/test/bin/build.sh deleted file mode 100755 index a000403..0000000 --- a/test/bin/build.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# 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. -# -FILE=${1:?go file} -EXEC=${2:-main} -OUT=$(basename $FILE) -BIN=${OUT%%.go} -ZIP=${BIN}.zip -go build -i -o bin/$BIN $FILE -GOOS=linux GOARCH=amd64 go build -o $EXEC $FILE -zip zip/$ZIP $EXEC -rm $EXEC -echo "built $EXEC bin/$BIN zip/$ZIP" diff --git a/test/bin/init.sh b/test/bin/init.sh deleted file mode 100755 index 6efc105..0000000 --- a/test/bin/init.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. -# -FILE=${1:?file} -MAIN=${2:-} -JSON=/tmp/json$$ -if test -n "$MAIN" -then MAIN=",\"main\":\"$MAIN\"" -fi -if file -i $FILE | grep text/ >/dev/null -then echo '{"value":{"code":' $(cat $FILE | jq -R -s .) $MAIN '}}' >$JSON -else echo '{"value":{"binary":true,"code":"'$(base64 -w 0 $FILE)'"}}' >$JSON -fi -curl -H "Content-Type: application/json" -XPOST -w "%{http_code}\n" http://${HOST:-localhost}:${PORT:-8080}/init -d @"$JSON" 2>/dev/null -#echo $JSON -#echo $MAIN -rm $JSON 2>/dev/null diff --git a/test/bin/post.sh b/test/bin/post.sh deleted file mode 100755 index fbe853e..0000000 --- a/test/bin/post.sh +++ /dev/null @@ -1,19 +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. -# -FILE=${1:?file} -curl -H "Content-Type: application/json" -XPOST -w "%{http_code}\n" http://localhost:${PORT:-8080}/init -d @$FILE 2>/dev/null diff --git a/test/bin/run.sh b/test/bin/run.sh deleted file mode 100755 index 637c4cf..0000000 --- a/test/bin/run.sh +++ /dev/null @@ -1,22 +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. -# -DEFAULT='{"name": "Mike"}' -JSON=${1:-$DEFAULT} -DATA='{"value":'$JSON'}' -curl -H "Content-Type: application/json" -w "%{http_code}\n" -XPOST http://${HOST:-localhost}:${PORT:-8080}/run -d "$DATA" 2>/dev/null - diff --git a/test/crammer.sh b/test/crammer.sh deleted file mode 100644 index b968fe4..0000000 --- a/test/crammer.sh +++ /dev/null @@ -1,21 +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. -# -export T=$PWD -while read -p "> " line -do eval ${line#$} -done diff --git a/test/etc/hello.go b/test/etc/hello.go deleted file mode 100644 index 990f919..0000000 --- a/test/etc/hello.go +++ /dev/null @@ -1,34 +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 action - -import ( - "encoding/json" - "log" -) - -func Main(event json.RawMessage) (json.RawMessage, error) { - var obj map[string]interface{} - json.Unmarshal(event, &obj) - name, ok := obj["name"].(string) - if !ok { - name = "Stranger" - } - log.Printf("name=%s\n", name) - msg := map[string]string{"hello": ("Hello, " + name + "!")} - return json.Marshal(msg) -} diff --git a/test/etc/hello.js b/test/etc/hello.js deleted file mode 100644 index 90bc08c..0000000 --- a/test/etc/hello.js +++ /dev/null @@ -1,23 +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. - */ - -function main(args) { - return { - "result": "Hello, "+args.name - } -} -exports.main = main diff --git a/test/etc/hello.sh b/test/etc/hello.sh deleted file mode 100755 index dc4d760..0000000 --- a/test/etc/hello.sh +++ /dev/null @@ -1,28 +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. -# -while read line -do - name="$(echo $line | jq -r .name)" - if test "$name" == "" - then exit - fi - echo "name=$name" - hello="Hello, $name" - echo '{"hello":"'$hello'"}' >&3 -done - diff --git a/test/golang/hello/hello.go b/test/golang/hello/hello.go deleted file mode 100644 index 95e1586..0000000 --- a/test/golang/hello/hello.go +++ /dev/null @@ -1,40 +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 action - -import ( - "encoding/json" - "fmt" -) - -func Hello(event json.RawMessage) (json.RawMessage, error) { - var obj struct { - Name string `json:",omitempty"` - } - err := json.Unmarshal(event, &obj) - if err != nil { - return nil, err - } - name := obj.Name - if name == "" { - name = "Stranger" - } - fmt.Printf("name=%s\n", name) - msg := map[string]string{"hello": ("Hello, " + name + "!")} - return json.Marshal(msg) -} diff --git a/test/golang/main/main.go b/test/golang/main/main.go deleted file mode 100644 index 2bfd8c1..0000000 --- a/test/golang/main/main.go +++ /dev/null @@ -1,35 +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 action - -import ( - "encoding/json" - "fmt" -) - -func Main(event json.RawMessage) (json.RawMessage, error) { - var obj map[string]interface{} - json.Unmarshal(event, &obj) - name, ok := obj["name"].(string) - if !ok { - name = "Stranger" - } - fmt.Printf("name=%s\n", name) - msg := map[string]string{"message": ("Hello, " + name + "!")} - return json.Marshal(msg) -} diff --git a/test/golang/out/hello b/test/golang/out/hello deleted file mode 100755 index a252d9d..0000000 Binary files a/test/golang/out/hello and /dev/null differ diff --git a/test/golang/out/main b/test/golang/out/main deleted file mode 100755 index 5bbd213..0000000 Binary files a/test/golang/out/main and /dev/null differ diff --git a/test/src/empty.go b/test/src/empty.go deleted file mode 100644 index 35a2611..0000000 --- a/test/src/empty.go +++ /dev/null @@ -1,20 +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 main - -func main() {} diff --git a/test/src/hello/hello.go b/test/src/hello/hello.go deleted file mode 100644 index 2baaa01..0000000 --- a/test/src/hello/hello.go +++ /dev/null @@ -1,46 +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 hello - -import ( - "encoding/json" - "fmt" - "log" -) - -// Hello receive an event in format -// { "name": "Mike"} -// and returns a greeting in format -// { "greetings": "Hello, Mike"} -func Hello(event json.RawMessage) (json.RawMessage, error) { - // input and output - var input struct { - Name string - } - var output struct { - Greetings string `json:"greetings"` - } - // read the input event - json.Unmarshal(event, &input) - if input.Name != "" { - // handle the event - output.Greetings = "Hello, " + input.Name - log.Println(output.Greetings) - return json.Marshal(output) - } - return nil, fmt.Errorf("no name specified") -} diff --git a/test/src/hello/hello_test.go b/test/src/hello/hello_test.go deleted file mode 100644 index 94de222..0000000 --- a/test/src/hello/hello_test.go +++ /dev/null @@ -1,44 +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 hello - -import ( - "fmt" -) - -func ExampleHello() { - name := []byte(`{ "name": "Mike"}`) - data, _ := Hello(name) - fmt.Printf("%s", data) - // Output: - // {"greetings":"Hello, Mike"} -} - -func ExampleHello_noName() { - name := []byte(`{ "noname": "Mike"}`) - _, err := Hello(name) - fmt.Print(err) - // Output: - // no name specified -} -func ExampleHello_badJson() { - name := []byte(`{{`) - _, err := Hello(name) - fmt.Print(err) - // Output: - // no name specified -} diff --git a/test/src/hello_greeting.go b/test/src/hello_greeting.go deleted file mode 100644 index 8b8b02a..0000000 --- a/test/src/hello_greeting.go +++ /dev/null @@ -1,30 +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 main - -import ( - "log" - "os" - - "github.com/apache/incubator-openwhisk-client-go/whisk" - "github.com/apache/incubator-openwhisk-runtime-go/test/src/action" -) - -func main() { - log.SetPrefix("hello_greeting: ") - whisk.StartWithArgs(action.Hello, os.Args[1:]) -} diff --git a/test/src/hello_message.go b/test/src/hello_message.go deleted file mode 100644 index c29170d..0000000 --- a/test/src/hello_message.go +++ /dev/null @@ -1,42 +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 main - -import ( - "encoding/json" - "log" - "os" - - "github.com/apache/incubator-openwhisk-client-go/whisk" -) - -func sayHello(event json.RawMessage) (json.RawMessage, error) { - var obj map[string]interface{} - json.Unmarshal(event, &obj) - name, ok := obj["name"].(string) - if !ok { - name = "Stranger" - } - log.Printf("name=%s\n", name) - msg := map[string]string{"message": ("Hello, " + name + "!")} - return json.Marshal(msg) -} - -func main() { - log.SetPrefix("hello_message: ") - whisk.StartWithArgs(sayHello, os.Args[1:]) -} diff --git a/test/src/hi.go b/test/src/hi.go deleted file mode 100644 index 6a07be8..0000000 --- a/test/src/hi.go +++ /dev/null @@ -1,24 +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 main - -import "fmt" - -func main() { - fmt.Println("hi") -} diff --git a/test/start.sh b/test/start.sh deleted file mode 100755 index efbb953..0000000 --- a/test/start.sh +++ /dev/null @@ -1,32 +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. -# -if netstat -tlnp 2>/dev/null | grep :8080 >/dev/null -then exit 0 -fi -cd "$(dirname $0)" -bin/build.sh src/hello_greeting.go -bin/build.sh src/hello_message.go -bin/build.sh src/empty.go -bin/build.sh src/hi.go -zip -j zip/hello_message1.zip bin/hello_message -rm -Rvf action -mkdir action -if test -n "$1" -then docker run --name=goproxy -p 8080:8080 -d "$@" -else go run ../main/proxy.go -debug -fi diff --git a/test/stop.sh b/test/stop.sh deleted file mode 100755 index 961fd6d..0000000 --- a/test/stop.sh +++ /dev/null @@ -1,26 +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. -# -IMG=$(docker ps -q -f name=goproxy) -if test -n "$IMG" -then docker kill $IMG >/dev/null 2>/dev/null - docker rm $IMG >/dev/null 2>/dev/null -fi -PID=$(lsof -t -i:8080) -if test -n "$PID" -then kill -9 $PID 2>&1 >/dev/null -fi diff --git a/test/swift/hello/hello.swift b/test/swift/hello/hello.swift deleted file mode 100644 index 4a1dee1..0000000 --- a/test/swift/hello/hello.swift +++ /dev/null @@ -1,25 +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. - */ - -func hello(args: [String:Any]) -> [String:Any] { - if let name = args["name"] as? String { - print(name) - return [ "hello" : "Hello \(name)!" ] - } else { - return [ "hello" : "Hello swif4!" ] - } -} diff --git a/test/swift/main/main.swift b/test/swift/main/main.swift deleted file mode 100644 index 059a1a0..0000000 --- a/test/swift/main/main.swift +++ /dev/null @@ -1,24 +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. - */ -func main(args: [String:Any]) -> [String:Any] { - if let name = args["name"] as? String { - print(name) - return [ "main" : "Hello \(name)!" ] - } else { - return [ "main" : "Hello swif4!" ] - } -} diff --git a/test/swift/out/hello b/test/swift/out/hello deleted file mode 100755 index 0c6aca6..0000000 Binary files a/test/swift/out/hello and /dev/null differ diff --git a/test/swift/out/main b/test/swift/out/main deleted file mode 100755 index 2174175..0000000 Binary files a/test/swift/out/main and /dev/null differ diff --git a/test/test_actionloop-golang.t b/test/test_actionloop-golang.t deleted file mode 100644 index e82b49f..0000000 --- a/test/test_actionloop-golang.t +++ /dev/null @@ -1,66 +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. -# - - $ export T=$TESTDIR - $ $T/start.sh actionloop-golang-v1.10 2>$T/err.log >$T/out.log - - $ $T/bin/run.sh - {"error":"no action defined yet"} - 400 - - $ $T/bin/post.sh $T/etc/empty.json - {"ok":true} - 200 - - $ $T/bin/init.sh $T/bin/empty - {"error":"cannot start action: command exited"} - 400 - - - $ $T/bin/run.sh - {"error":"no action defined yet"} - 400 - - $ $T/bin/init.sh $T/etc/hello.go - {"ok":true} - 200 - - $ $T/bin/run.sh - {"hello":"Hello, Mike!"} - 200 - - $ $T/bin/run.sh '{"name":"world"}' - {"hello":"Hello, world!"} - 200 - - $ $T/bin/init.sh $T/bin/hello_message - {"ok":true} - 200 - - $ $T/bin/run.sh - {"message":"Hello, Mike!"} - 200 - - $ $T/bin/init.sh $T/zip/hello_greeting.zip - {"ok":true} - 200 - - $ $T/bin/run.sh - {"greetings":"Hello, Mike"} - 200 - - $ $T/stop.sh diff --git a/test/test_actionloop.t b/test/test_actionloop.t deleted file mode 100644 index 4435404..0000000 --- a/test/test_actionloop.t +++ /dev/null @@ -1,133 +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. -# - - $ export T=$TESTDIR - $ $T/start.sh actionloop 2>$T/err.log >$T/out.log - -Default: no action defined - - $ $T/bin/post.sh $T/etc/empty.json - {"ok":true} - 200 - - $ $T/bin/run.sh - {"error":"no action defined yet"} - 400 - - $ $T/bin/init.sh $T/etc/hello.go - {"error":"cannot start action: command exited"} - 400 - - $ $T/bin/init.sh $T/bin/empty - {"error":"cannot start action: command exited"} - 400 - - $ $T/bin/init.sh $T/bin/hi - {"error":"cannot start action: command exited"} - 400 - - $ $T/bin/run.sh - {"error":"no action defined yet"} - 400 - -Sending some messages - - $ $T/bin/init.sh $T/bin/hello_message - {"ok":true} - 200 - - $ $T/bin/run.sh - {"message":"Hello, Mike!"} - 200 - - $ $T/bin/init.sh $T/bin/hello_greeting - {"ok":true} - 200 - - $ $T/bin/run.sh - {"greetings":"Hello, Mike"} - 200 - - $ $T/bin/init.sh $T/zip/hello_message.zip - {"ok":true} - 200 - - $ $T/bin/run.sh - {"message":"Hello, Mike!"} - 200 - - $ $T/bin/init.sh $T/zip/hello_greeting.zip - {"ok":true} - 200 - - $ $T/bin/run.sh - {"greetings":"Hello, Mike"} - 200 - -Invalid script - - $ $T/bin/init.sh $T/test_actionloop.t - {"error":"cannot start action: command exited"} - 400 - - $ $T/bin/run.sh - {"greetings":"Hello, Mike"} - 200 - - $ $T/bin/init.sh $T/bin/empty - {"error":"cannot start action: command exited"} - 400 - - $ $T/bin/run.sh - {"greetings":"Hello, Mike"} - 200 - - $ $T/bin/init.sh $T/bin/hi - {"error":"cannot start action: command exited"} - 400 - -A shell script - - $ $T/bin/init.sh $T/etc/hello.sh - {"ok":true} - 200 - - $ $T/bin/run.sh - {"hello":"Hello, Mike"} - 200 - - $ $T/bin/run.sh '{"name": ""}' - {"error":"command exited"} - 400 - - $ $T/bin/run.sh - {"error":"no action defined yet"} - 400 - - -Test with a non-main executable - - $ $T/bin/init.sh $T/zip/hello_message1.zip - {"error":"cannot start action: command exited"} - 400 - - $ $T/bin/init.sh $T/zip/hello_message1.zip hello_message - {"error":"cannot start action: command exited"} - 400 - - - $ $T/stop.sh diff --git a/test/zip/.gitignore b/test/zip/.gitignore deleted file mode 100644 index c4c4ffc..0000000 --- a/test/zip/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.zip ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
