This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
The following commit(s) were added to refs/heads/main by this push:
new 522297c cleaned up tests
522297c is described below
commit 522297c83fafdac4d76ded22551027b07307eb74
Author: Michele Sciabarra <[email protected]>
AuthorDate: Tue Jul 23 19:22:19 2024 +0200
cleaned up tests
---
Taskfile.yml | 6 +++-
tests/deploy.bats | 94 -----------------------------------------------------
tests/js.bats | 44 -------------------------
tests/prefixes.bats | 6 ++--
tests/realpath.bats | 48 ---------------------------
tests/zipf.bats | 36 --------------------
6 files changed, 8 insertions(+), 226 deletions(-)
diff --git a/Taskfile.yml b/Taskfile.yml
index 290cd3f..68786d5 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -78,7 +78,11 @@ tasks:
desc: unit test nuv
cmds:
- rm -Rf ~/.nuv/olaris
- - go test ./...
+ - go test github.com/apache/openserverless-cli
+ - go test github.com/apache/openserverless-cli/config
+ - go test github.com/apache/openserverless-cli/tools
+ - echo TODO go test github.com/apache/openserverless-cli/auth
+
bats:
dir: tests
diff --git a/tests/deploy.bats b/tests/deploy.bats
deleted file mode 100644
index d7593b4..0000000
--- a/tests/deploy.bats
+++ /dev/null
@@ -1,94 +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.
-
-setup() {
- load 'test_helper/bats-support/load'
- load 'test_helper/bats-assert/load'
- export NO_COLOR=1
-}
-
-@test "-deploy with help flag" {
- run nuv -deploy -h
- assert_line --partial "Usage:"
-}
-
-@test "-deploy with missing packages folder" {
- run nuv -deploy .
- assert_line --partial "no 'packages' folder found in the current directory"
- assert_failure
-}
-
-@test "-deploy with single flag with root sfa" {
- run nuv -deploy -s hello.js -d testdata
- assert_line --partial "*** hello.js"
- assert_line --partial "Would run: nuv action update hello
packages/hello.js"
- assert_success
-}
-
-@test "-deploy with single flag with packaged sfa" {
- run nuv -deploy -s subfolder/hello.py -d testdata
- assert_line --partial "*** hello.py"
- assert_line --partial "Would run: nuv package update subfolder"
- assert_line --partial "Would run: nuv action update subfolder/hello
packages/subfolder/hello.py"
- assert_success
-}
-
-@test "-deploy with single flag with unsupported folder" {
- run nuv -deploy -s subfolder -d testdata
- assert_line --partial "*** subfolder"
- assert_line --partial "action packages/subfolder is a directory but does
not contain a supported main file"
- assert_failure
-}
-
-@test "-deploy with single flag with supported folder" {
- run nuv -deploy -s okfolder -d $(pwd)/testdata
- assert_line --partial "*** okfolder"
- assert_line --partial "Would run: nuv package update okfolder"
- assert_line --partial "Would run: nuv action update okfolder/index
packages/okfolder/index.js"
- assert_success
-}
-
-@test "-deploy with single flag with unsupported MFA" {
- run nuv -deploy -s okfolder/badmfa -d $(pwd)/testdata
- assert_line --partial "*** badmfa"
- assert_line --partial "action packages/okfolder/badmfa is a directory but
does not contain a supported main file"
- assert_failure
-}
-
-@test "-deploy with single flag with MFA" {
- run nuv -deploy -s okfolder/okmfa -d $(pwd)/testdata
- assert_line --partial "*** okmfa"
- assert_line --partial "Would run: nuv ide util action A=okfolder/okmfa"
- assert_line --partial "Would run: nuv package update okfolder"
- assert_line --partial "Would run: nuv action update okfolder/okmfa
packages/okfolder/okmfa.zip"
- assert_success
-}
-
-@test "-deploy with scan works" {
- run nuv -deploy -d testdata/example
- assert_line --partial ">>> Scan:"
- assert_line --partial "Would run: nuv ide util zip A=zipped/mfa"
- assert_line --partial "Would run: nuv ide util action A=sub/mfa"
- assert_line --partial "> packages/sub/index.js"
- assert_line --partial ">>> Deploying:"
- assert_line --partial "Would run: nuv package update zipped"
- assert_line --partial "Would run: nuv package update sub"
- assert_line --partial "Would run: nuv action update zipped/mfa
packages/zipped/mfa.zip"
- assert_line --partial "Would run: nuv action update sub/mfa
packages/sub/mfa.zip"
- assert_line --partial "Would run: nuv action update sub/index
packages/sub/index.js"
- assert_success
-}
\ No newline at end of file
diff --git a/tests/js.bats b/tests/js.bats
deleted file mode 100644
index 2d07178..0000000
--- a/tests/js.bats
+++ /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.
-
-setup() {
- load 'test_helper/bats-support/load'
- load 'test_helper/bats-assert/load'
- export NO_COLOR=1
-}
-
-@test "-js with simple file.js" {
- run nuv -js testdata/js_simple_test.js
- assert_line --partial "2 + 2 = 4"
- assert_success
-}
-
-@test "-js with js function" {
- run nuv -js testdata/js_function_test.js
- assert_line --partial "3"
- assert_success
-}
-
-@test "-js argv" {
- run nuv -js testdata/js_test_argv.js a b c
- assert_line --partial "goja,testdata/js_test_argv.js,a,b,c"
-}
-
-@test "-js with nuv module" {
- run nuv -js testdata/js_read_file.js testdata/testfiletype.txt
- assert_line --partial "a sample text"
-}
diff --git a/tests/prefixes.bats b/tests/prefixes.bats
index 07c08eb..4646142 100644
--- a/tests/prefixes.bats
+++ b/tests/prefixes.bats
@@ -34,14 +34,14 @@ setup() {
@test "nuv sub simple invoked with prefixes" {
run nuv sub simple
- assert_line "task: [simple] echo simple"
+ assert_line "ops: [simple] echo simple"
assert_line "simple"
run nuv s simple
- assert_line "task: [simple] echo simple"
+ assert_line "ops: [simple] echo simple"
assert_line "simple"
run nuv s s
- assert_line "task: [simple] echo simple"
+ assert_line "ops: [simple] echo simple"
assert_line "simple"
}
diff --git a/tests/realpath.bats b/tests/realpath.bats
deleted file mode 100644
index 0683f33..0000000
--- a/tests/realpath.bats
+++ /dev/null
@@ -1,48 +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.
-
-setup() {
- load 'test_helper/bats-support/load'
- load 'test_helper/bats-assert/load'
- export NO_COLOR=1
-}
-
-@test "-realpath help message" {
- run nuv -realpath
- assert_line "Usage: nuv -realpath <path>"
-
- run nuv -realpath -h
- assert_line "Usage: nuv -realpath <path>"
-}
-
-@test "-realpath with relative path" {
- WD=$(pwd)
- run nuv -realpath ./test
- assert_success
- assert_output "${WD}/test"
-}
-
-@test "-realpath with absolute path" {
- WD=$(pwd)
- run nuv -realpath "${WD}/test"
- assert_success
- assert_output "${WD}/test"
-
- run nuv -realpath "${WD}/./test"
- assert_success
- assert_output "${WD}/test"
-}
\ No newline at end of file
diff --git a/tests/zipf.bats b/tests/zipf.bats
deleted file mode 100644
index e8904b6..0000000
--- a/tests/zipf.bats
+++ /dev/null
@@ -1,36 +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.
-
-setup() {
- load 'test_helper/bats-support/load'
- load 'test_helper/bats-assert/load'
- export NO_COLOR=1
-}
-
-@test "zipf message" {
- run nuv -zipf
- assert_line "Usage:"
-
- run nuv -zipf -h
- assert_line "Usage:"
-}
-
-# @test "zipf zips" {
-# run nuv -zipf testdata/actions
-# assert_success
-# run rm actions.zip
-# }