This is an automated email from the ASF dual-hosted git repository.
rabbah 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 c9fb555 Remove older runtimes. (#4254)
c9fb555 is described below
commit c9fb555c950a1fff124e1071b0db518bcbe181cd
Author: TPei <[email protected]>
AuthorDate: Sat Feb 9 14:54:48 2019 +0100
Remove older runtimes. (#4254)
This PR removes some older and the deprecated runtimes form the manifest.
It also modifies the ExecManifest initializer to allow for loading of a
test manifest that isn't based on the deployment.
---
ansible/files/runtimes.json | 114 +------------
.../openwhisk/core/entity/ExecManifest.scala | 30 ++--
.../src/main/resources/apiv1swagger.json | 12 +-
docs/actions-new.md | 8 +-
docs/actions-nodejs.md | 2 +-
docs/actions-php.md | 8 +-
docs/actions-python.md | 10 +-
docs/actions-swift.md | 177 +--------------------
tests/dat/actions/unicode.tests/php-7.1.txt | 9 --
tests/dat/actions/unicode.tests/php-7.2.txt | 9 --
tests/dat/actions/unicode.tests/swift-3.1.1.txt | 12 --
tests/dat/actions/unicode.tests/swift-4.1.txt | 12 --
.../docker/test/DockerContainerFactoryTests.scala | 2 +-
.../core/controller/test/ActionsApiTests.scala | 165 +++++++++++--------
.../controller/test/PackageActionsApiTests.scala | 2 +-
.../SequenceActionApiMigrationTests.scala | 4 +-
.../openwhisk/core/entity/test/ExecHelpers.scala | 54 ++-----
.../core/entity/test/ExecManifestTests.scala | 7 +-
.../openwhisk/core/entity/test/SchemaTests.scala | 25 ++-
.../test/ShardingContainerPoolBalancerTests.scala | 2 +-
20 files changed, 187 insertions(+), 477 deletions(-)
diff --git a/ansible/files/runtimes.json b/ansible/files/runtimes.json
index e5989db..c3e80d3 100644
--- a/ansible/files/runtimes.json
+++ b/ansible/files/runtimes.json
@@ -2,21 +2,8 @@
"runtimes": {
"nodejs": [
{
- "kind": "nodejs",
- "image": {
- "prefix": "openwhisk",
- "name": "nodejsaction",
- "tag": "latest"
- },
- "deprecated": true,
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
"kind": "nodejs:6",
- "default": true,
+ "default": false,
"image": {
"prefix": "openwhisk",
"name": "nodejs6action",
@@ -50,7 +37,7 @@
},
{
"kind": "nodejs:10",
- "default": false,
+ "default": true,
"image": {
"prefix": "openwhisk",
"name": "action-nodejs-v10",
@@ -65,21 +52,8 @@
],
"python": [
{
- "kind": "python",
- "image": {
- "prefix": "openwhisk",
- "name": "python2action",
- "tag": "latest"
- },
- "deprecated": false,
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
"kind": "python:2",
- "default": true,
+ "default": false,
"image": {
"prefix": "openwhisk",
"name": "python2action",
@@ -93,6 +67,7 @@
},
{
"kind": "python:3",
+ "default": true,
"image": {
"prefix": "openwhisk",
"name": "python3action",
@@ -107,59 +82,6 @@
],
"swift": [
{
- "kind": "swift",
- "image": {
- "prefix": "openwhisk",
- "name": "swiftaction",
- "tag": "latest"
- },
- "deprecated": true,
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
- "kind": "swift:3",
- "image": {
- "prefix": "openwhisk",
- "name": "swift3action",
- "tag": "latest"
- },
- "deprecated": true,
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
- "kind": "swift:3.1.1",
- "image": {
- "prefix": "openwhisk",
- "name": "action-swift-v3.1.1",
- "tag": "latest"
- },
- "deprecated": false,
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
- "kind": "swift:4.1",
- "default": false,
- "image": {
- "prefix": "openwhisk",
- "name": "action-swift-v4.1",
- "tag": "latest"
- },
- "deprecated": false,
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
"kind": "swift:4.2",
"default": true,
"image": {
@@ -193,34 +115,6 @@
],
"php": [
{
- "kind": "php:7.1",
- "default": false,
- "deprecated": false,
- "image": {
- "prefix": "openwhisk",
- "name": "action-php-v7.1",
- "tag": "latest"
- },
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
- "kind": "php:7.2",
- "default": false,
- "deprecated": false,
- "image": {
- "prefix": "openwhisk",
- "name": "action-php-v7.2",
- "tag": "latest"
- },
- "attached": {
- "attachmentName": "codefile",
- "attachmentType": "text/plain"
- }
- },
- {
"kind": "php:7.3",
"default": true,
"deprecated": false,
diff --git
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ExecManifest.scala
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ExecManifest.scala
index 33439c5..60fe587 100644
---
a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ExecManifest.scala
+++
b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ExecManifest.scala
@@ -44,11 +44,12 @@ protected[core] object ExecManifest {
* singleton Runtime instance.
*
* @param config a valid configuration
+ * @param manifestOverride an optional inline manifest (used for testing)
* @return the manifest if initialized successfully, or an failure
*/
- protected[core] def initialize(config: WhiskConfig): Try[Runtimes] = {
+ protected[core] def initialize(config: WhiskConfig, manifestOverride:
Option[String] = None): Try[Runtimes] = {
val rmc = loadConfigOrThrow[RuntimeManifestConfig](ConfigKeys.runtimes)
- val mf =
Try(config.runtimesManifest.parseJson.asJsObject).flatMap(runtimes(_, rmc))
+ val mf =
Try(manifestOverride.getOrElse(config.runtimesManifest).parseJson.asJsObject).flatMap(runtimes(_,
rmc))
mf.foreach(m => manifest = Some(m))
mf
}
@@ -102,7 +103,7 @@ protected[core] object ExecManifest {
* @param bypassPullForLocalImages if true, allow images with a prefix that
matches localImagePrefix
* to skip docker pull on invoker even if
the image is not part of the blackbox set;
* this is useful for testing with local
images that aren't published to the runtimes registry
- * @param localImagePrefix image prefix for bypassPullForLocalImages
+ * @param localImagePrefix image prefix for bypassPullForLocalImages
*/
protected[core] case class RuntimeManifestConfig(bypassPullForLocalImages:
Option[Boolean] = None,
localImagePrefix:
Option[String] = None)
@@ -110,14 +111,14 @@ protected[core] object ExecManifest {
/**
* A runtime manifest describes the "exec" runtime support.
*
- * @param kind the name of the kind e.g., nodejs:6
- * @param deprecated true iff the runtime is deprecated (allows get/delete
but not create/update/invoke)
- * @param default true iff the runtime is the default kind for its family
(nodejs:default -> nodejs:6)
- * @param attached true iff the source is an attachments (not inlined source)
- * @param requireMain true iff main entry point is not optional
+ * @param kind the name of the kind e.g., nodejs:6
+ * @param deprecated true iff the runtime is deprecated (allows
get/delete but not create/update/invoke)
+ * @param default true iff the runtime is the default kind for its
family (nodejs:default -> nodejs:6)
+ * @param attached true iff the source is an attachments (not inlined
source)
+ * @param requireMain true iff main entry point is not optional
* @param sentinelledLogs true iff the runtime generates stdout/stderr log
sentinels after an activation
- * @param image optional image name, otherwise inferred via fixed mapping
(remove colons and append 'action')
- * @param stemCells optional list of stemCells to be initialized by invoker
per kind
+ * @param image optional image name, otherwise inferred via fixed
mapping (remove colons and append 'action')
+ * @param stemCells optional list of stemCells to be initialized by
invoker per kind
*/
protected[core] case class RuntimeManifest(kind: String,
image: ImageName,
@@ -131,7 +132,7 @@ protected[core] object ExecManifest {
/**
* A stemcell configuration read from the manifest for a container image to
be initialized by the container pool.
*
- * @param count the number of stemcell containers to create
+ * @param count the number of stemcell containers to create
* @param memory the max memory this stemcell will allocate
*/
protected[entity] case class StemCell(count: Int, memory: ByteSize) {
@@ -256,7 +257,8 @@ protected[core] object ExecManifest {
/**
* A runtime family manifest is a collection of runtimes grouped by a family
(e.g., swift with versions swift:2 and swift:3).
- * @param family runtime family
+ *
+ * @param name runtime family
* @version set of runtime manifests
*/
protected[entity] case class RuntimeFamily(name: String, versions:
Set[RuntimeManifest])
@@ -264,7 +266,9 @@ protected[core] object ExecManifest {
/**
* A collection of runtime families.
*
- * @param set of supported runtime families
+ * @param runtimes set of supported runtime families
+ * @param blackboxImages set of blackbox container images
+ * @param bypassPullForLocalImages container image prefix that is exempted
from docker pull operations
*/
protected[core] case class Runtimes(runtimes: Set[RuntimeFamily],
blackboxImages: Set[ImageName],
diff --git a/core/controller/src/main/resources/apiv1swagger.json
b/core/controller/src/main/resources/apiv1swagger.json
index 72c0efc..8e5a609 100644
--- a/core/controller/src/main/resources/apiv1swagger.json
+++ b/core/controller/src/main/resources/apiv1swagger.json
@@ -1893,20 +1893,22 @@
"nodejs:8",
"nodejs:10",
"nodejs:default",
- "php:7.1",
- "php:7.2",
"php:7.3",
+ "php:default",
"python:2",
"python:3",
"python:default",
"ruby:2.5",
+ "ruby:default",
"go:1.11",
+ "go:default",
"sequence",
- "swift:3.1.1",
- "swift:4.1",
"swift:4.2",
+ "swift:default",
"dotnet:2.2",
- "ballerina:0.990"
+ "dotnet:default",
+ "ballerina:0.990",
+ "ballerina:default"
],
"description": "the type of action"
},
diff --git a/docs/actions-new.md b/docs/actions-new.md
index 11c72d2..aee3e0e 100644
--- a/docs/actions-new.md
+++ b/docs/actions-new.md
@@ -66,16 +66,16 @@ as in `nodejs:8` or `php:7.3`.
The manifest is a map of runtime family names to an array of specific kinds.
The details of the
schema are found in the [Exec
Manifest](../common/scala/src/main/scala/org/apache/openwhisk/core/entity/ExecManifest.scala).
As an example, the following entry add a new runtime family called `nodejs`
with a single kind
-`nodejs:6`.
+`nodejs:10`.
```json
{
"nodejs": [{
- "kind": "nodejs:6",
+ "kind": "nodejs:10",
"default": true,
"image": {
"prefix": "openwhisk",
- "name": "nodejs6action",
+ "name": "nodejs10action",
"tag": "latest"
}
}]
@@ -84,7 +84,7 @@ As an example, the following entry add a new runtime family
called `nodejs` with
The `default` property indicates if the corresponding kind should be treated
as the
default for the runtime family. The JSON `image` structure defines the Docker
image name
-that is used for actions of this kind (e.g., `openwhisk/nodejs6action:latest`
for the
+that is used for actions of this kind (e.g., `openwhisk/nodejs10action:latest`
for the
JSON example above).
### Canonical runtime repository
diff --git a/docs/actions-nodejs.md b/docs/actions-nodejs.md
index 9ce26ee..ad98f9a 100644
--- a/docs/actions-nodejs.md
+++ b/docs/actions-nodejs.md
@@ -217,7 +217,7 @@ To create an OpenWhisk action from this package:
3. Create the action:
```
- wsk action create packageAction --kind nodejs:6 action.zip
+ wsk action create packageAction --kind nodejs:10 action.zip
```
When creating an action from a `.zip` archive with the CLI tool, you must
explicitly provide a value for the `--kind` flag by using `nodejs:10`,
`nodejs:8` or `nodejs:6`.
diff --git a/docs/actions-php.md b/docs/actions-php.md
index b5a2fbb..dfb69be 100644
--- a/docs/actions-php.md
+++ b/docs/actions-php.md
@@ -23,15 +23,13 @@ The process of creating PHP actions is similar to that of
[other actions](action
The following sections guide you through creating and invoking a single PHP
action,
and demonstrate how to bundle multiple PHP files and third party dependencies.
-PHP actions are executed using PHP 7.3. PHP 7.2 & PHP 7.1 are also available.
The specific
+PHP actions are executed using PHP 7.3. The specific
version of PHP is listed in the CHANGELOG files in the [PHP runtime
repository](https://github.com/apache/incubator-openwhisk-runtime-php).
To use a PHP runtime, specify the `wsk` CLI parameter `--kind` when creating or
updating an action. The available PHP kinds are:
* PHP 7.3: `--kind php:7.3`
-* PHP 7.2: `--kind php:7.2`
-* PHP 7.1: `--kind php:7.1`
An action is simply a top-level PHP function. For example, create a file
called `hello.php`
with the following source code:
@@ -88,7 +86,7 @@ zip -r helloPHP.zip index.php helper.php
and then create the action:
```bash
-wsk action create helloPHP --kind php:7.1 helloPHP.zip
+wsk action create helloPHP --kind php:7.3 helloPHP.zip
```
## Including Composer dependencies
@@ -99,7 +97,7 @@ Add this directory to your action's zip file and create the
action:
```bash
zip -r helloPHP.zip index.php vendor
-wsk action create helloPHP --kind php:7.1 helloPHP.zip
+wsk action create helloPHP --kind php:7.3 helloPHP.zip
```
The PHP runtime will automatically include Composer's autoloader for you, so
you can immediately
diff --git a/docs/actions-python.md b/docs/actions-python.md
index 561b7a0..fc3732f 100644
--- a/docs/actions-python.md
+++ b/docs/actions-python.md
@@ -44,9 +44,9 @@ You can create an OpenWhisk action called `helloPython` from
this function as fo
wsk action create helloPython hello.py
```
The CLI automatically infers the type of the action from the source file
extension.
-For `.py` source files, the action runs using a Python 2.7 runtime.
-You can also create an action that runs with Python 3.6 by explicitly
specifying the parameter
-`--kind python:3`.
+For `.py` source files, the action runs using a Python 3.6 runtime.
+You can also create an action that runs with Python 2.7 by explicitly
specifying the parameter
+`--kind python:2`.
Action invocation is the same for Python actions as it is for any other
actions:
@@ -108,7 +108,7 @@ While the steps above are shown for Python 3.6, you can do
the same for Python 2
## Python 3 actions
-Python 3 actions are executed using Python 3.6.1. To use this runtime, specify
the `wsk` CLI parameter `--kind python:3` when creating or updating an action.
+Python 3 actions are executed using Python 3.6.1. This is the default runtime
for Python actions, unless you specify the `--kind` flag when creating or
updating an action.
The following packages are available for use by Python actions, in addition to
the Python 3.6 standard libraries.
- aiohttp v1.3.3
@@ -156,7 +156,7 @@ The following packages are available for use by Python
actions, in addition to t
## Python 2 actions
-Python 2 actions are executed using Python 2.7.12. This is the default runtime
for Python actions, unless you specify the `--kind` flag when creating or
updating an action. To explicitly select this runtime, use `--kind python:2`.
The following packages are available for use by Python 2 actions, in addition
to the Python 2.7 standard library.
+Python 2 actions are executed using Python 2.7.12. To use this runtime,
specify the `wsk` CLI parameter `--kind python:2` when creating or updating an
action. The following packages are available for use by Python 2 actions, in
addition to the Python 2.7 standard library.
- appdirs v1.4.3
- asn1crypto v0.21.1
diff --git a/docs/actions-swift.md b/docs/actions-swift.md
index 195624c..78d1bde 100644
--- a/docs/actions-swift.md
+++ b/docs/actions-swift.md
@@ -30,7 +30,7 @@ and OpenWhisk usually uses the latest available release,
which is not necessaril
In addition, the version of Swift that is used with OpenWhisk might be
inconsistent with versions
of Swift from stable releases of Xcode on MacOS.
-### Swift 3
+### Swift 4
An action is simply a top-level Swift function. For example, create a file
called
`hello.swift` with the following content:
@@ -49,10 +49,10 @@ You can create an OpenWhisk action called `helloSwift` from
this function as
follows:
```
-wsk action create helloSwift hello.swift --kind swift:3.1.1
+wsk action create helloSwift hello.swift
```
-### Swift 4
+### Swift 4 Codable type
New in Swift 4 in addition of the above main function signature there are two
more signatures out of the box taking advantage of the
[Codable](https://developer.apple.com/documentation/swift/codable) type. You
can learn more about data types encodable and decodable for compatibility with
external representations such as JSON
[here](https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types).
@@ -87,7 +87,7 @@ You can create a OpenWhisk action called `helloSwift` from
this function as
follows:
```
-wsk action create helloSwift hello.swift --kind swift:4.2
+wsk action create helloSwift hello.swift
```
@@ -187,164 +187,7 @@ wsk action update helloSwiftly action-bin.zip --kind
swift:4.2
wsk action invoke helloSwiftly -r
```
-## Compiling Swift 4.1 packaged actions
-
-### Using a script to build Swift 3.1.1 and 4.1 packaged actions
-You can use a script to automate the packaging of the action. Create script
`compile.sh`h file the following.
-```bash
-#!/bin/bash
-set -ex
-
-if [ -z "$1" ] ; then
- echo 'Error: Missing action name'
- exit 1
-fi
-if [ -z "$2" ] ; then
- echo 'Error: Missing kind, for example swift:4.1'
- exit 2
-fi
-OUTPUT_DIR="build"
-if [ ${2} == "swift:3.1.1" ]; then
- BASE_PATH="/swift3Action"
- DEST_SOURCE="$BASE_PATH/spm-build"
- RUNTIME="openwhisk/action-swift-v3.1.1"
-elif [ ${2} == "swift:4.1" ]; then
- RUNTIME="openwhisk/action-swift-v4.1"
- BASE_PATH="/swift4Action"
- DEST_SOURCE="/$BASE_PATH/spm-build/Sources/Action"
-else
- echo "Error: Kind $2 not recognize"
- exit 3
-fi
-DEST_PACKAGE_SWIFT="$BASE_PATH/spm-build/Package.swift"
-
-BUILD_FLAGS=""
-if [ -n "$3" ] ; then
- BUILD_FLAGS=${3}
-fi
-
-echo "Using runtime $RUNTIME to compile swift"
-docker run --rm --name=compile-ow-swift -it -v "$(pwd):/owexec" $RUNTIME bash
-ex -c "
-
-if [ -f \"/owexec/$OUTPUT_DIR/$1.zip\" ] ; then
- rm \"/owexec/$OUTPUT_DIR/$1.zip\"
-fi
-
-echo 'Setting up build...'
-cp /owexec/actions/$1/Sources/*.swift $DEST_SOURCE/
-
-# action file can be either {action name}.swift or main.swift
-if [ -f \"$DEST_SOURCE/$1.swift\" ] ; then
- echo 'renaming $DEST_SOURCE/$1.swift $DEST_SOURCE/main.swift'
- mv \"$DEST_SOURCE/$1.swift\" $DEST_SOURCE/main.swift
-fi
-# Add in the OW specific bits
-cat $BASE_PATH/epilogue.swift >> $DEST_SOURCE/main.swift
-echo '_run_main(mainFunction:main)' >> $DEST_SOURCE/main.swift
-
-# Only for Swift4
-if [ ${2} != "swift:3.1.1" ]; then
- echo 'Adding wait to deal with escaping'
- echo '_ = _whisk_semaphore.wait(timeout: .distantFuture)' >>
$DEST_SOURCE/main.swift
-fi
-
-echo \"Compiling $1...\"
-cd /$BASE_PATH/spm-build
-cp /owexec/actions/$1/Package.swift $DEST_PACKAGE_SWIFT
-# we have our own Package.swift, do a full compile
-swift build ${BUILD_FLAGS} -c release
-
-echo 'Creating archive $1.zip...'
-#.build/release/Action
-mkdir -p /owexec/$OUTPUT_DIR
-zip \"/owexec/$OUTPUT_DIR/$1.zip\" .build/release/Action
-
-"
-```
-
-The script assumes you have a directory `actions` with each top level
directory representing an action.
-```
-actions/
-├── hello
-│ ├── Package.swift
-│ └── Sources
-│ └── main.swift
-```
-
-- Create the `Package.swift` file to add dependencies.
-The syntax is different from Swift 3 to Swift 4 tools.
-For Swift 3 here is an example:
- ```swift
- import PackageDescription
-
- let package = Package(
- name: "Action",
- dependencies: [
- .Package(url:
"https://github.com/apple/example-package-deckofplayingcards.git",
majorVersion: 3),
- .Package(url: "https://github.com/IBM-Swift/CCurl.git", "0.2.3"),
- .Package(url: "https://github.com/IBM-Swift/Kitura-net.git",
"1.7.10"),
- .Package(url: "https://github.com/IBM-Swift/SwiftyJSON.git",
"15.0.1"),
- .Package(url:
"https://github.com/watson-developer-cloud/swift-sdk.git", "0.16.0")
- ]
- )
- ```
- For Swift 4 here is an example:
- ```swift
- // swift-tools-version:4.0
- import PackageDescription
-
- let package = Package(
- name: "Action",
- products: [
- .executable(
- name: "Action",
- targets: ["Action"]
- )
- ],
- dependencies: [
- .package(url:
"https://github.com/apple/example-package-deckofplayingcards.git",
.upToNextMajor(from: "3.0.0"))
- ],
- targets: [
- .target(
- name: "Action",
- dependencies: ["DeckOfPlayingCards"],
- path: "."
- )
- ]
- )
- ```
- As you can see this example adds `example-package-deckofplayingcards` as a
dependency.
- Notice that `CCurl`, `Kitura-net` and `SwiftyJSON` are provided in the
standard Swift action
-and so you should include them in your own `Package.swift` only for Swift 3
actions.
-
-- Build the action by running the following command for a Swift 3 action:
- ```
- bash compile.sh hello swift:3.1.1
- ```
- To compile for Swift 4 use `swift:4.1` instead of `swift:3.1.1`
- ```
- bash compile.sh hello swift:4.1
- ```
- This has created hello.zip in the `build`.
-
-- Upload it to OpenWhisk with the action name helloSwifty:
- For Swift 3 use the kind `swift:3.1.1`
- ```
- wsk action update helloSwiftly build/hello.zip --kind swift:3.1.1
- ```
- For Swift 4.1 use the kind `swift:4.1`
- ```
- wsk action update helloSwiftly build/hello.zip --kind swift:4.1
- ```
-
-- To check how much faster it is, run
- ```
- wsk action invoke helloSwiftly --blocking
- ```
-
- The time it took for the action to run is in the "duration" property and
compare to the time it takes to run with a compilation step in the hello action.
-
-## Error Handling in Swift 4.x
+## Error Handling in Swift 4
With the new Codable completion handler, you can pass an Error to indicate a
failure in your Action.
[Error handling in
Swift](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ErrorHandling.html)
resembles exception handling in other languages, with the use of the `try,
catch` and `throw` keywords.
@@ -367,16 +210,8 @@ func main(param: Input, completion: (Output?, Error?) ->
Void) -> Void {
## Reference
-### Swift 3
-Swift 3 actions are executed using Swift 3.1.1 `--kind swift:3.1.1`.
-
-Swift 3.1.1 actions can use the following packages:
-- KituraNet version 1.7.6, https://github.com/IBM-Swift/Kitura-net
-- SwiftyJSON version 15.0.1, https://github.com/IBM-Swift/SwiftyJSON
-- Watson Developer Cloud SDK version 0.16.0,
https://github.com/watson-developer-cloud/swift-sdk
-
### Swift 4
-Swift 4 actions can be executed using Swift 4.1 or 4.2 using `--kind
swift:4.1` or `--kind swift:4.2` respectively.
+Swift 4 actions are executed using Swift 4.2 using `--kind swift:4.2`
respectively.
The default `--kind swift:default` is Swift 4.2.
Swift 4.x action runtimes don't embed any packages, follow the instructions
for [packaged swift
actions](./actions.md#packaging-an-action-as-a-swift-executable) to include
dependencies using a Package.swift.
diff --git a/tests/dat/actions/unicode.tests/php-7.1.txt
b/tests/dat/actions/unicode.tests/php-7.1.txt
deleted file mode 100644
index bdd88cb..0000000
--- a/tests/dat/actions/unicode.tests/php-7.1.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-// Licensed to the Apache Software Foundation (ASF) under one or more
contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-function main(array $args) : array {
- $str = $args['delimiter'] . " ☃ " . $args['delimiter'];
- echo $str . "\n";
- return ["winter" => $str];
-}
diff --git a/tests/dat/actions/unicode.tests/php-7.2.txt
b/tests/dat/actions/unicode.tests/php-7.2.txt
deleted file mode 100644
index bdd88cb..0000000
--- a/tests/dat/actions/unicode.tests/php-7.2.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-// Licensed to the Apache Software Foundation (ASF) under one or more
contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-function main(array $args) : array {
- $str = $args['delimiter'] . " ☃ " . $args['delimiter'];
- echo $str . "\n";
- return ["winter" => $str];
-}
diff --git a/tests/dat/actions/unicode.tests/swift-3.1.1.txt
b/tests/dat/actions/unicode.tests/swift-3.1.1.txt
deleted file mode 100644
index 756d9cd..0000000
--- a/tests/dat/actions/unicode.tests/swift-3.1.1.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-func main(args: [String:Any]) -> [String:Any] {
- if let str = args["delimiter"] as? String {
- let msg = "\(str) ☃ \(str)"
- print(msg)
- return [ "winter" : msg ]
- } else {
- return [ "error" : "no delimiter" ]
- }
-}
diff --git a/tests/dat/actions/unicode.tests/swift-4.1.txt
b/tests/dat/actions/unicode.tests/swift-4.1.txt
deleted file mode 100644
index 756d9cd..0000000
--- a/tests/dat/actions/unicode.tests/swift-4.1.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-func main(args: [String:Any]) -> [String:Any] {
- if let str = args["delimiter"] as? String {
- let msg = "\(str) ☃ \(str)"
- print(msg)
- return [ "winter" : msg ]
- } else {
- return [ "error" : "no delimiter" ]
- }
-}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
index 212de56..4bd6e3b 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
@@ -60,7 +60,7 @@ class DockerContainerFactoryTests
it should "set the docker run args based on ContainerArgsConfig" in {
- val image = ExecManifest.runtimesManifest.manifests("nodejs").image
+ val image = ExecManifest.runtimesManifest.manifests("nodejs:10").image
implicit val tid = TransactionId.testing
val dockerApiStub = mock[DockerApiWithFileAccess]
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
index eea2409..32eedde 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
@@ -245,23 +245,23 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
// String: binary: true, main: jsMain
val jsAction1 = WhiskAction(namespace, aname(), jsDefault("RHViZWU=",
Some("jsMain")))
val jsAction1Content =
- Map("exec" -> Map("kind" -> NODEJS6, "code" -> "RHViZWU=", "main" ->
"jsMain")).toJson.asJsObject
- val jsAction1ExecMetaData = js6MetaData(Some("jsMain"), true)
+ Map("exec" -> Map("kind" -> NODEJS10, "code" -> "RHViZWU=", "main" ->
"jsMain")).toJson.asJsObject
+ val jsAction1ExecMetaData = js10MetaData(Some("jsMain"), true)
// String: binary: false, main: jsMain
val jsAction2 = WhiskAction(namespace, aname(), jsDefault("",
Some("jsMain")))
- val jsAction2Content = Map("exec" -> Map("kind" -> NODEJS6, "code" -> "",
"main" -> "jsMain")).toJson.asJsObject
- val jsAction2ExecMetaData = js6MetaData(Some("jsMain"), false)
+ val jsAction2Content = Map("exec" -> Map("kind" -> NODEJS10, "code" -> "",
"main" -> "jsMain")).toJson.asJsObject
+ val jsAction2ExecMetaData = js10MetaData(Some("jsMain"), false)
// String: binary: true, no main
val jsAction3 = WhiskAction(namespace, aname(), jsDefault("RHViZWU="))
- val jsAction3Content = Map("exec" -> Map("kind" -> NODEJS6, "code" ->
"RHViZWU=")).toJson.asJsObject
- val jsAction3ExecMetaData = js6MetaData(None, true)
+ val jsAction3Content = Map("exec" -> Map("kind" -> NODEJS10, "code" ->
"RHViZWU=")).toJson.asJsObject
+ val jsAction3ExecMetaData = js10MetaData(None, true)
// String: binary: false, no main
val jsAction4 = WhiskAction(namespace, aname(), jsDefault(""))
- val jsAction4Content = Map("exec" -> Map("kind" -> NODEJS6, "code" ->
"")).toJson.asJsObject
- val jsAction4ExecMetaData = js6MetaData(None, false)
+ val jsAction4Content = Map("exec" -> Map("kind" -> NODEJS10, "code" ->
"")).toJson.asJsObject
+ val jsAction4ExecMetaData = js10MetaData(None, false)
// Sequence
val component = WhiskAction(namespace, aname(), jsDefault("??"))
@@ -486,7 +486,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
val parameters = keys map { key =>
Parameters(key.toString, "a" * 10)
} reduce (_ ++ _)
- val content =
s"""{"exec":{"kind":"nodejs","code":"??"},"parameters":$parameters}""".stripMargin
+ val content =
s"""{"exec":{"kind":"nodejs:default","code":"??"},"parameters":$parameters}""".stripMargin
Put(s"$collectionPath/${aname()}", content.parseJson.asJsObject) ~>
Route.seal(routes(creds)) ~> check {
status should be(RequestEntityTooLarge)
responseAs[String] should include {
@@ -502,7 +502,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
val annotations = keys map { key =>
Parameters(key.toString, "a" * 10)
} reduce (_ ++ _)
- val content =
s"""{"exec":{"kind":"nodejs","code":"??"},"annotations":$annotations}""".stripMargin
+ val content =
s"""{"exec":{"kind":"nodejs:default","code":"??"},"annotations":$annotations}""".stripMargin
Put(s"$collectionPath/${aname()}", content.parseJson.asJsObject) ~>
Route.seal(routes(creds)) ~> check {
status should be(RequestEntityTooLarge)
responseAs[String] should include {
@@ -542,7 +542,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
action.limits,
action.version,
action.publish,
- action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS6)))
+ action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS10)))
}
}
@@ -612,7 +612,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
deleteAction(action.docid)
status should be(OK)
val response = responseAs[WhiskAction]
- response.exec.kind should be(NODEJS6)
+ response.exec.kind should be(NODEJS10)
response.parameters shouldBe Parameters()
}
}
@@ -631,7 +631,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
deleteAction(action.docid)
status should be(OK)
val response = responseAs[WhiskAction]
- response.exec.kind should be(NODEJS6)
+ response.exec.kind should be(NODEJS10)
response.parameters should be(Parameters("a", "A"))
}
}
@@ -660,7 +660,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
action.limits,
action.version,
action.publish,
- action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS6)))
+ action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS10)))
}
}
@@ -700,7 +700,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
action.limits,
action.version,
action.publish,
- action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS6)))
+ action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS10)))
}
}
@@ -708,7 +708,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
val javaAction =
WhiskAction(namespace, aname(), javaDefault("ZHViZWU=", Some("hello")),
annotations = Parameters("exec", "java"))
val nodeAction = WhiskAction(namespace, aname(), jsDefault("??"),
Parameters("x", "b"))
- val actions = Seq((javaAction, JAVA_DEFAULT), (nodeAction, NODEJS6))
+ val actions = Seq((javaAction, JAVA_DEFAULT), (nodeAction, NODEJS10))
actions.foreach {
case (action, kind) =>
@@ -808,9 +808,9 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
javaDefault(nonInlinedCode(entityStore), Some("hello")),
annotations = Parameters("exec", "java"))
val nodeAction = WhiskAction(namespace, aname(),
jsDefault(nonInlinedCode(entityStore)), Parameters("x", "b"))
- val swiftAction = WhiskAction(namespace, aname(),
swift3(nonInlinedCode(entityStore)), Parameters("x", "b"))
+ val swiftAction = WhiskAction(namespace, aname(),
swift(nonInlinedCode(entityStore)), Parameters("x", "b"))
val bbAction = WhiskAction(namespace, aname(), bb("bb",
nonInlinedCode(entityStore), Some("bbMain")))
- val actions = Seq((javaAction, JAVA_DEFAULT), (nodeAction, NODEJS6),
(swiftAction, SWIFT3), (bbAction, BLACKBOX))
+ val actions = Seq((javaAction, JAVA_DEFAULT), (nodeAction, NODEJS10),
(swiftAction, SWIFT4), (bbAction, BLACKBOX))
actions.foreach {
case (action, kind) =>
@@ -979,9 +979,9 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
it should "get an action with attachment that is not cached" in {
implicit val tid = transid()
val nodeAction = WhiskAction(namespace, aname(),
jsDefault(nonInlinedCode(entityStore)), Parameters("x", "b"))
- val swiftAction = WhiskAction(namespace, aname(),
swift3(nonInlinedCode(entityStore)), Parameters("x", "b"))
+ val swiftAction = WhiskAction(namespace, aname(),
swift(nonInlinedCode(entityStore)), Parameters("x", "b"))
val bbAction = WhiskAction(namespace, aname(), bb("bb",
nonInlinedCode(entityStore), Some("bbMain")))
- val actions = Seq((nodeAction, NODEJS6), (swiftAction, SWIFT3), (bbAction,
BLACKBOX))
+ val actions = Seq((nodeAction, NODEJS10), (swiftAction, SWIFT4),
(bbAction, BLACKBOX))
actions.foreach {
case (action, kind) =>
@@ -1030,7 +1030,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
it should "concurrently get an action with attachment that is not cached" in
{
implicit val tid = transid()
val action = WhiskAction(namespace, aname(),
jsDefault(nonInlinedCode(entityStore)), Parameters("x", "b"))
- val kind = NODEJS6
+ val kind = NODEJS10
val content = WhiskActionPut(
Some(action.exec),
@@ -1085,9 +1085,9 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
it should "update an existing action with attachment that is not cached" in {
implicit val tid = transid()
val nodeAction = WhiskAction(namespace, aname(),
jsDefault(nonInlinedCode(entityStore)), Parameters("x", "b"))
- val swiftAction = WhiskAction(namespace, aname(),
swift3(nonInlinedCode(entityStore)), Parameters("x", "b"))
+ val swiftAction = WhiskAction(namespace, aname(),
swift(nonInlinedCode(entityStore)), Parameters("x", "b"))
val bbAction = WhiskAction(namespace, aname(), bb("bb",
nonInlinedCode(entityStore), Some("bbMain")))
- val actions = Seq((nodeAction, NODEJS6), (swiftAction, SWIFT3), (bbAction,
BLACKBOX))
+ val actions = Seq((nodeAction, NODEJS10), (swiftAction, SWIFT4),
(bbAction, BLACKBOX))
actions.foreach {
case (action, kind) =>
@@ -1154,7 +1154,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
it should "ensure old and new action schemas are supported" in {
implicit val tid = transid()
val code = nonInlinedCode(entityStore)
- val actionOldSchema = WhiskAction(namespace, aname(), js6Old(code))
+ val actionOldSchema = WhiskAction(namespace, aname(), js10Old(code))
val actionNewSchema = WhiskAction(namespace, aname(), jsDefault(code))
val content = WhiskActionPut(
Some(actionOldSchema.exec),
@@ -1191,7 +1191,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
actionOldSchema.limits,
actionOldSchema.version.upPatch,
actionOldSchema.publish,
- actionOldSchema.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS6)))
+ actionOldSchema.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS10)))
}
stream.toString should include regex (expectedPutLog)
@@ -1215,7 +1215,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
actionOldSchema.limits,
actionOldSchema.version.upPatch,
actionOldSchema.publish,
- actionOldSchema.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS6)))
+ actionOldSchema.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS10)))
}
}
@@ -1258,7 +1258,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
content.limits.get.logs.get,
content.limits.get.concurrency.get),
version = action.version.upPatch,
- annotations = action.annotations ++
Parameters(WhiskAction.execFieldName, NODEJS6))
+ annotations = action.annotations ++
Parameters(WhiskAction.execFieldName, NODEJS10))
}
}
}
@@ -1279,7 +1279,7 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
action.exec,
content.parameters.get,
version = action.version.upPatch,
- annotations = action.annotations ++
Parameters(WhiskAction.execFieldName, NODEJS6))
+ annotations = action.annotations ++
Parameters(WhiskAction.execFieldName, NODEJS10))
}
}
}
@@ -1562,51 +1562,90 @@ class ActionsApiTests extends ControllerTestCommon with
WhiskActionsApi {
// get and delete allowed, create/update with deprecated exec not allowed,
post/invoke not allowed
it should "report proper error when runtime is deprecated" in {
implicit val tid = transid()
- val action = WhiskAction(namespace, aname(), swift("??"))
- val okUpdate = WhiskActionPut(Some(swift3("_")))
- val badUpdate = WhiskActionPut(Some(swift("_")))
- Put(s"$collectionPath/${action.name}", WhiskActionPut(Some(action.exec)))
~> Route.seal(routes(creds)) ~> check {
- status shouldBe BadRequest
- responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
- }
+ try {
+ val okKind = "test:1"
+ val deprecatedKind = "test:2"
+
+ val customManifest = Some(s"""
+ |{ "runtimes": {
+ | "test": [
+ | {
+ | "kind": "$okKind",
+ | "deprecated": false,
+ | "default": true,
+ | "image": {
+ | "name": "xyz"
+ | }
+ | }, {
+ | "kind": "$deprecatedKind",
+ | "deprecated": true,
+ | "image": {
+ | "name": "xyz"
+ | }
+ | }
+ | ]
+ | }
+ |}
+ |""".stripMargin)
+ ExecManifest.initialize(whiskConfig, customManifest)
+
+ val deprecatedManifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(deprecatedKind).get
+ val deprecatedExec =
+ CodeExecAsAttachment(deprecatedManifest,
Attachments.serdes[String].read(JsString("??")), None)
+
+ val okManifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(okKind).get
+ val okExec = CodeExecAsAttachment(okManifest,
Attachments.serdes[String].read(JsString("??")), None)
+
+ val action = WhiskAction(namespace, aname(), deprecatedExec)
+ val okUpdate = WhiskActionPut(Some(okExec))
+ val badUpdate = WhiskActionPut(Some(deprecatedExec))
+
+ Put(s"$collectionPath/${action.name}",
WhiskActionPut(Some(action.exec))) ~> Route.seal(routes(creds)) ~> check {
+ status shouldBe BadRequest
+ responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
+ }
- Put(s"$collectionPath/${action.name}?overwrite=true",
WhiskActionPut(Some(action.exec))) ~> Route.seal(
- routes(creds)) ~> check {
- status shouldBe BadRequest
- responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
- }
+ Put(s"$collectionPath/${action.name}?overwrite=true",
WhiskActionPut(Some(action.exec))) ~> Route.seal(
+ routes(creds)) ~> check {
+ status shouldBe BadRequest
+ responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
+ }
- put(entityStore, action)
+ put(entityStore, action)
- Put(s"$collectionPath/${action.name}?overwrite=true", JsObject.empty) ~>
Route.seal(routes(creds)) ~> check {
- status shouldBe BadRequest
- responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
- }
+ Put(s"$collectionPath/${action.name}?overwrite=true", JsObject.empty) ~>
Route.seal(routes(creds)) ~> check {
+ status shouldBe BadRequest
+ responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
+ }
- Put(s"$collectionPath/${action.name}?overwrite=true", badUpdate) ~>
Route.seal(routes(creds)) ~> check {
- status shouldBe BadRequest
- responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
- }
+ Put(s"$collectionPath/${action.name}?overwrite=true", badUpdate) ~>
Route.seal(routes(creds)) ~> check {
+ status shouldBe BadRequest
+ responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
+ }
- Post(s"$collectionPath/${action.name}") ~> Route.seal(routes(creds)) ~>
check {
- status shouldBe BadRequest
- responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
- }
+ Post(s"$collectionPath/${action.name}") ~> Route.seal(routes(creds)) ~>
check {
+ status shouldBe BadRequest
+ responseAs[ErrorResponse].error shouldBe
Messages.runtimeDeprecated(action.exec)
+ }
- Get(s"$collectionPath/${action.name}") ~> Route.seal(routes(creds)) ~>
check {
- status shouldBe OK
- }
+ Get(s"$collectionPath/${action.name}") ~> Route.seal(routes(creds)) ~>
check {
+ status shouldBe OK
+ }
- Delete(s"$collectionPath/${action.name}") ~> Route.seal(routes(creds)) ~>
check {
- status shouldBe OK
- }
+ Delete(s"$collectionPath/${action.name}") ~> Route.seal(routes(creds))
~> check {
+ status shouldBe OK
+ }
- put(entityStore, action)
+ put(entityStore, action)
- Put(s"$collectionPath/${action.name}?overwrite=true", okUpdate) ~>
Route.seal(routes(creds)) ~> check {
- deleteAction(action.docid)
- status shouldBe OK
+ Put(s"$collectionPath/${action.name}?overwrite=true", okUpdate) ~>
Route.seal(routes(creds)) ~> check {
+ deleteAction(action.docid)
+ status shouldBe OK
+ }
+ } finally {
+ // restore manifest
+ ExecManifest.initialize(whiskConfig)
}
}
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackageActionsApiTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackageActionsApiTests.scala
index 582e995..59bc153 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackageActionsApiTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackageActionsApiTests.scala
@@ -162,7 +162,7 @@ class PackageActionsApiTests extends ControllerTestCommon
with WhiskActionsApi {
action.limits,
action.version,
action.publish,
- action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS6)))
+ action.annotations ++ Parameters(WhiskAction.execFieldName,
NODEJS10)))
}
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/migration/SequenceActionApiMigrationTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/migration/SequenceActionApiMigrationTests.scala
index 2fab59e..6650573 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/migration/SequenceActionApiMigrationTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/migration/SequenceActionApiMigrationTests.scala
@@ -98,7 +98,7 @@ class SequenceActionApiMigrationTests
deleteAction(action.docid)
status should be(OK)
val response = responseAs[WhiskAction]
- response.exec.kind should be(NODEJS6)
+ response.exec.kind should be(NODEJS10)
response.parameters should be(Parameters("a", "A"))
}
}
@@ -117,7 +117,7 @@ class SequenceActionApiMigrationTests
deleteAction(action.docid)
status should be(OK)
val response = responseAs[WhiskAction]
- response.exec.kind should be(NODEJS6)
+ response.exec.kind should be(NODEJS10)
response.parameters shouldBe Parameters()
}
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
index b6eae32..190ee47 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
@@ -35,12 +35,9 @@ trait ExecHelpers extends Matchers with WskActorSystem with
StreamLogging {
private val config = new WhiskConfig(ExecManifest.requiredProperties)
ExecManifest.initialize(config) should be a 'success
- protected val NODEJS = "nodejs"
- protected val NODEJS6 = "nodejs:6"
- protected val SWIFT = "swift"
- protected val SWIFT3 = "swift:3.1.1"
+ protected val NODEJS10 = "nodejs:10"
+ protected val SWIFT4 = "swift:4.2"
protected val BLACKBOX = "blackbox"
- protected val SWIFT3_IMAGE = "action-swift-v3.1.1"
protected val JAVA_DEFAULT = "java"
private def attFmt[T: JsonFormat] = Attachments.serdes[T]
@@ -49,44 +46,34 @@ trait ExecHelpers extends Matchers with WskActorSystem with
StreamLogging {
ExecManifest.runtimesManifest.runtimes.flatMap(_.versions).find(_.kind ==
name).get.image
}
- protected def jsOld(code: String, main: Option[String] = None) = {
- CodeExecAsString(RuntimeManifest(NODEJS, imagename(NODEJS), deprecated =
Some(true)), trim(code), main.map(_.trim))
- }
-
- protected def js(code: String, main: Option[String] = None) = {
- val attachment = attFmt[String].read(code.trim.toJson)
- val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(NODEJS).get
-
- CodeExecAsAttachment(manifest, attachment, main.map(_.trim),
Exec.isBinaryCode(code))
- }
-
- protected def js6Old(code: String, main: Option[String] = None) = {
+ protected def js10Old(code: String, main: Option[String] = None) = {
CodeExecAsString(
RuntimeManifest(
- NODEJS6,
- imagename(NODEJS6),
+ NODEJS10,
+ imagename(NODEJS10),
default = Some(true),
deprecated = Some(false),
stemCells = Some(List(StemCell(2, 256.MB)))),
trim(code),
main.map(_.trim))
}
- protected def js6(code: String, main: Option[String] = None) = {
+
+ protected def js10(code: String, main: Option[String] = None) = {
val attachment = attFmt[String].read(code.trim.toJson)
- val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(NODEJS6).get
+ val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(NODEJS10).get
CodeExecAsAttachment(manifest, attachment, main.map(_.trim),
Exec.isBinaryCode(code))
}
protected def jsDefault(code: String, main: Option[String] = None) = {
- js6(code, main)
+ js10(code, main)
}
- protected def js6MetaDataOld(main: Option[String] = None, binary: Boolean) =
{
+ protected def js10MetaDataOld(main: Option[String] = None, binary: Boolean)
= {
CodeExecMetaDataAsString(
RuntimeManifest(
- NODEJS6,
- imagename(NODEJS6),
+ NODEJS10,
+ imagename(NODEJS10),
default = Some(true),
deprecated = Some(false),
stemCells = Some(List(StemCell(2, 256.MB)))),
@@ -94,8 +81,8 @@ trait ExecHelpers extends Matchers with WskActorSystem with
StreamLogging {
main.map(_.trim))
}
- protected def js6MetaData(main: Option[String] = None, binary: Boolean) = {
- val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(NODEJS6).get
+ protected def js10MetaData(main: Option[String] = None, binary: Boolean) = {
+ val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(NODEJS10).get
CodeExecMetaDataAsAttachment(manifest, binary, main.map(_.trim))
}
@@ -113,20 +100,9 @@ trait ExecHelpers extends Matchers with WskActorSystem
with StreamLogging {
CodeExecMetaDataAsAttachment(manifest, binary, main.map(_.trim))
}
- protected def swiftOld(code: String, main: Option[String] = None) = {
- CodeExecAsString(RuntimeManifest(SWIFT, imagename(SWIFT), deprecated =
Some(true)), trim(code), main.map(_.trim))
- }
-
protected def swift(code: String, main: Option[String] = None) = {
val attachment = attFmt[String].read(code.trim.toJson)
- val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(SWIFT).get
-
- CodeExecAsAttachment(manifest, attachment, main.map(_.trim),
Exec.isBinaryCode(code))
- }
-
- protected def swift3(code: String, main: Option[String] = None) = {
- val attachment = attFmt[String].read(code.trim.toJson)
- val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(SWIFT3).get
+ val manifest =
ExecManifest.runtimesManifest.resolveDefaultRuntime(SWIFT4).get
CodeExecAsAttachment(manifest, attachment, main.map(_.trim),
Exec.isBinaryCode(code))
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecManifestTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecManifestTests.scala
index 6c5c2ad..24cb35b 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecManifestTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecManifestTests.scala
@@ -226,6 +226,7 @@ class ExecManifestTests extends FlatSpec with
WskActorSystem with StreamLogging
| "nodef": [
| {
| "kind": "nodejs:6",
+ | "deprecated": true,
| "image": {
| "name": "nodejsaction"
| },
@@ -275,7 +276,11 @@ class ExecManifestTests extends FlatSpec with
WskActorSystem with StreamLogging
|}
|""".stripMargin.parseJson.asJsObject
- val js6 = RuntimeManifest("nodejs:6", ImageName("nodejsaction"), stemCells
= Some(List(StemCell(1, 128.MB))))
+ val js6 = RuntimeManifest(
+ "nodejs:6",
+ ImageName("nodejsaction"),
+ deprecated = Some(true),
+ stemCells = Some(List(StemCell(1, 128.MB))))
val js8 = RuntimeManifest(
"nodejs:8",
ImageName("nodejsaction"),
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
index 311da40..1974008 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
@@ -476,19 +476,18 @@ class SchemaTests extends FlatSpec with BeforeAndAfter
with ExecHelpers with Mat
it should "initialize exec manifest" in {
val runtimes = ExecManifest.runtimesManifest
- runtimes.resolveDefaultRuntime("nodejs:default").get.kind shouldBe
"nodejs:6"
- runtimes.resolveDefaultRuntime("swift").get.deprecated shouldBe Some(true)
+ runtimes.resolveDefaultRuntime("nodejs:default").get.kind shouldBe
"nodejs:10"
}
it should "properly deserialize and reserialize JSON" in {
val b64Body = """ZnVuY3Rpb24gbWFpbihhcmdzKSB7IHJldHVybiBhcmdzOyB9Cg=="""
val json = Seq[JsObject](
- JsObject("kind" -> "nodejs:6".toJson, "code" -> "js1".toJson, "binary"
-> false.toJson),
- JsObject("kind" -> "nodejs:6".toJson, "code" -> "js2".toJson, "binary"
-> false.toJson, "foo" -> "bar".toJson),
- JsObject("kind" -> "swift".toJson, "code" -> "swift1".toJson, "binary"
-> false.toJson),
- JsObject("kind" -> "swift:3.1.1".toJson, "code" -> b64Body.toJson,
"binary" -> true.toJson),
- JsObject("kind" -> "nodejs:6".toJson, "code" -> b64Body.toJson, "binary"
-> true.toJson))
+ JsObject("kind" -> "nodejs:10".toJson, "code" -> "js1".toJson, "binary"
-> false.toJson),
+ JsObject("kind" -> "nodejs:10".toJson, "code" -> "js2".toJson, "binary"
-> false.toJson, "foo" -> "bar".toJson),
+ JsObject("kind" -> "swift:4.2".toJson, "code" -> "swift1".toJson,
"binary" -> false.toJson),
+ JsObject("kind" -> "swift:4.2".toJson, "code" -> b64Body.toJson,
"binary" -> true.toJson),
+ JsObject("kind" -> "nodejs:10".toJson, "code" -> b64Body.toJson,
"binary" -> true.toJson))
val execs = json.map { e =>
Exec.serdes.read(e)
@@ -497,7 +496,7 @@ class SchemaTests extends FlatSpec with BeforeAndAfter with
ExecHelpers with Mat
assert(execs(0) == jsDefault("js1") && json(0) == jsDefault("js1").asJson)
assert(execs(1) == jsDefault("js2") && json(1) != jsDefault("js2").asJson)
// ignores unknown properties
assert(execs(2) == swift("swift1") && json(2) == swift("swift1").asJson)
- assert(execs(3) == swift3(b64Body) && json(3) == swift3(b64Body).asJson)
+ assert(execs(3) == swift(b64Body) && json(3) == swift(b64Body).asJson)
assert(execs(4) == jsDefault(b64Body) && json(4) ==
jsDefault(b64Body).asJson)
}
@@ -585,8 +584,8 @@ class SchemaTests extends FlatSpec with BeforeAndAfter with
ExecHelpers with Mat
JsObject.empty,
JsNull,
JsObject("init" -> "zipfile".toJson),
- JsObject("kind" -> "nodejs:6".toJson, "code" -> JsNumber(42)),
- JsObject("kind" -> "nodejs:6".toJson, "init" -> "zipfile".toJson),
+ JsObject("kind" -> "nodejs:10".toJson, "code" -> JsNumber(42)),
+ JsObject("kind" -> "nodejs:10".toJson, "init" -> "zipfile".toJson),
JsObject("kind" -> "turbopascal".toJson, "code" -> "BEGIN1".toJson),
JsObject("kind" -> "blackbox".toJson, "code" -> "js".toJson),
JsObject("kind" -> "swift".toJson, "swiftcode" -> "swift".toJson))
@@ -614,9 +613,9 @@ class SchemaTests extends FlatSpec with BeforeAndAfter with
ExecHelpers with Mat
it should "serialize to json" in {
val execs = Seq(bb("container"), jsDefault("js"), jsDefault("js"),
swift("swift")).map { _.asJson }
assert(execs(0) == JsObject("kind" -> "blackbox".toJson, "image" ->
"container".toJson, "binary" -> false.toJson))
- assert(execs(1) == JsObject("kind" -> "nodejs:6".toJson, "code" ->
"js".toJson, "binary" -> false.toJson))
- assert(execs(2) == JsObject("kind" -> "nodejs:6".toJson, "code" ->
"js".toJson, "binary" -> false.toJson))
- assert(execs(3) == JsObject("kind" -> "swift".toJson, "code" ->
"swift".toJson, "binary" -> false.toJson))
+ assert(execs(1) == JsObject("kind" -> "nodejs:10".toJson, "code" ->
"js".toJson, "binary" -> false.toJson))
+ assert(execs(2) == JsObject("kind" -> "nodejs:10".toJson, "code" ->
"js".toJson, "binary" -> false.toJson))
+ assert(execs(3) == JsObject("kind" -> "swift:4.2".toJson, "code" ->
"swift".toJson, "binary" -> false.toJson))
}
behavior of "Parameter"
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
index 8feb9a6..cda8dfd 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
@@ -417,7 +417,7 @@ class ShardingContainerPoolBalancerTests
WhiskActionMetaData(
namespace,
name,
- js6MetaData(Some("jsMain"), false),
+ js10MetaData(Some("jsMain"), false),
limits = actionLimits(actionMem, concurrency))
val maxContainers = invokerMem.toMB.toInt /
actionMetaData.limits.memory.megabytes
val numInvokers = 3