You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openserverless.apache.org by ms...@apache.org on 2026/09/12 14:50:01 UTC
(openserverless-cli) 05/05: fixed all the tests and added licenses
This is an automated email from the ASF dual-hosted git repository.
sciabarracom pushed a commit to branch 0.9.0
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit c8ec51d250e40b8e24199d11b1256766e61aef1e
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Sat Sep 12 16:47:24 2026 +0200
fixed all the tests and added licenses
---
.licenserc.yaml | 10 ++++++-
Taskfile.yml | 5 +++-
ops_test.go | 50 +++++++++++++++++-----------------
plugin_test.go | 70 ++++++++++++++++++++++++------------------------
prepare_test.go | 12 ++++-----
prereq_test.go | 2 +-
serve_test.go | 2 +-
tests/auto_setup.bats | 3 ++-
tests/help.bats | 5 ++--
tests/info.bats | 2 +-
tests/oplugins/README.md | 4 +--
tests/plugin.bats | 11 ++++----
tests/prereq_yml.bats | 10 +++----
tests/update_branch.bats | 3 ++-
updates_check_test.go | 6 ++---
15 files changed, 105 insertions(+), 90 deletions(-)
diff --git a/.licenserc.yaml b/.licenserc.yaml
index e8ced24..d97c74d 100644
--- a/.licenserc.yaml
+++ b/.licenserc.yaml
@@ -21,17 +21,25 @@ header:
spdx-id: Apache-2.0
copyright-owner: Apache Software Foundation
+ languages:
+ Text:
+ extensions:
+ - ".txt"
+ comment_style_id: Hashtag
+
paths-ignore:
- DISCLAIMER
- LICENSE
- NOTICE
- HEADER
- WARN
- # gitignored
- ops
- go.sum
- '**/*.json'
- 'empty_file'
+ # data files parsed verbatim by the code or asserted on by tests:
+ # a license header would corrupt their contents
+ - '**/*.txt'
dependency:
files:
diff --git a/Taskfile.yml b/Taskfile.yml
index 4a2eacb..262f169 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -128,6 +128,7 @@ tasks:
tests:
desc: all tests
cmds:
+ - touch tools/empty_file
- task: install
- task: utest
- task: itest
@@ -163,7 +164,9 @@ tasks:
dir: tests
cmds:
- task: bats
- - rm -Rf ~/.ops/oplugins ~/.ops/olaris
+ #- rm -Rf ~/.ops/oplugins ~/.ops/olaris
+ - ops -reset force
+ - ops -t
- |
unset DEBUG
unset TRACE
diff --git a/ops_test.go b/ops_test.go
index 7223233..310bbb1 100644
--- a/ops_test.go
+++ b/ops_test.go
@@ -30,26 +30,26 @@ import (
func Example_opsArg1() {
// test
_ = os.Chdir(workDir)
- olaris, _ := filepath.Abs(joinpath("tests", "olaris"))
- err := Ops(olaris, split("testcmd"))
+ oplugins, _ := filepath.Abs(joinpath("tests", "oplugins"))
+ err := Ops(oplugins, split("testcmd"))
fmt.Println(err)
/*
pr(2, err)
- err = Ops(olaris, split("testcmd arg"))
+ err = Ops(oplugins, split("testcmd arg"))
pr(3, err)
- err = Ops(olaris, split("testcmd arg VAR=1"))
+ err = Ops(oplugins, split("testcmd arg VAR=1"))
pr(4, err)
- err = Ops(olaris, split("testcmd VAR=1 arg"))
+ err = Ops(oplugins, split("testcmd VAR=1 arg"))
pr(5, err)
// Output:
- // (olaris) task [-t opsfile.yml testcmd --]
+ // (oplugins) task [-t opsfile.yml testcmd --]
// 2 <nil>
- // (olaris) task [-t opsfile.yml testcmd -- arg]
+ // (oplugins) task [-t opsfile.yml testcmd -- arg]
// 3 <nil>
- // (olaris) task [-t opsfile.yml testcmd VAR=1 -- arg]
+ // (oplugins) task [-t opsfile.yml testcmd VAR=1 -- arg]
// 4 <nil>
- // (olaris) task [-t opsfile.yml testcmd VAR=1 -- arg]
+ // (oplugins) task [-t opsfile.yml testcmd VAR=1 -- arg]
//5 <nil>
*/
}
@@ -57,23 +57,23 @@ func Example_opsArg1() {
func Example_opsArg() {
// test
_ = os.Chdir(workDir)
- olaris, _ := filepath.Abs(joinpath("tests", "olaris"))
- err := Ops(olaris, split("testcmd"))
+ oplugins, _ := filepath.Abs(joinpath("tests", "oplugins"))
+ err := Ops(oplugins, split("testcmd"))
pr(2, err)
- err = Ops(olaris, split("testcmd arg"))
+ err = Ops(oplugins, split("testcmd arg"))
pr(3, err)
- err = Ops(olaris, split("testcmd arg VAR=1"))
+ err = Ops(oplugins, split("testcmd arg VAR=1"))
pr(4, err)
- err = Ops(olaris, split("testcmd VAR=1 arg"))
+ err = Ops(oplugins, split("testcmd VAR=1 arg"))
pr(5, err)
// Output:
- // (olaris) task [-t opsfile.yml testcmd --]
+ // (oplugins) task [-t opsfile.yml testcmd --]
// 2 <nil>
- // (olaris) task [-t opsfile.yml testcmd -- arg]
+ // (oplugins) task [-t opsfile.yml testcmd -- arg]
// 3 <nil>
- // (olaris) task [-t opsfile.yml testcmd VAR=1 -- arg]
+ // (oplugins) task [-t opsfile.yml testcmd VAR=1 -- arg]
// 4 <nil>
- // (olaris) task [-t opsfile.yml testcmd VAR=1 -- arg]
+ // (oplugins) task [-t opsfile.yml testcmd VAR=1 -- arg]
//5 <nil>
}
@@ -81,17 +81,17 @@ func ExampleOps() {
// test
_ = os.Chdir(workDir)
os.Setenv("TEST_VAR", "evar")
- olaris, _ := filepath.Abs(joinpath("tests", "olaris"))
- err := Ops(olaris, split(""))
+ oplugins, _ := filepath.Abs(joinpath("tests", "oplugins"))
+ err := Ops(oplugins, split(""))
pr(1, err)
- err = Ops(olaris, split("sub"))
+ err = Ops(oplugins, split("sub"))
pr(4, err)
- err = Ops(olaris, split("sub opts"))
+ err = Ops(oplugins, split("sub opts"))
pr(5, err)
- _ = Ops(olaris, split("sub opts ciao 1"))
+ _ = Ops(oplugins, split("sub opts ciao 1"))
// pr(6, err)
// Output:
- // (olaris) task [-t opsfile.yml -l]
+ // (oplugins) task [-t opsfile.yml -l]
//
// Plugins:
// 1 <nil>
@@ -114,7 +114,7 @@ func ExampleOps() {
func ExampleParseArgs() {
_ = os.Chdir(workDir)
- usage := readfile("tests/olaris/sub/opts/docopts.txt")
+ usage := readfile("tests/oplugins/sub/opts/docopts.txt")
args := parseArgs(usage, split("ciao mike miri max"))
pr(1, args)
args = parseArgs(usage, split("ciao mike -c"))
diff --git a/plugin_test.go b/plugin_test.go
index cc16e57..feeeed7 100644
--- a/plugin_test.go
+++ b/plugin_test.go
@@ -48,22 +48,22 @@ func copyFile(srcPath, destPath string) error {
}
func setupPluginTest(dir string, t *testing.T) string {
t.Helper()
- // create the olaris-test folder
- olarisTestDir := filepath.Join(dir, "olaris-test")
- err := os.MkdirAll(olarisTestDir, 0755)
+ // create the oplugins-test folder
+ opluginsTestDir := filepath.Join(dir, "oplugins-test")
+ err := os.MkdirAll(opluginsTestDir, 0755)
require.NoError(t, err)
- // copy the opsroot.json from tests/olaris into the olaris-test folder
- opsRootJSON := filepath.Join("tests", "olaris", "opsroot.json")
- err = copyFile(opsRootJSON, filepath.Join(olarisTestDir, "opsroot.json"))
+ // copy the opsroot.json from tests/oplugins into the oplugins-test folder
+ opsRootJSON := filepath.Join("tests", "oplugins", "opsroot.json")
+ err = copyFile(opsRootJSON, filepath.Join(opluginsTestDir, "opsroot.json"))
require.NoError(t, err)
- // copy opsfile.yml from tests/olaris into the olaris-test folder
- opsfileYML := filepath.Join("tests", "olaris", "opsfile.yml")
- err = copyFile(opsfileYML, filepath.Join(olarisTestDir, "opsfile.yml"))
+ // copy opsfile.yml from tests/oplugins into the oplugins-test folder
+ opsfileYML := filepath.Join("tests", "oplugins", "opsfile.yml")
+ err = copyFile(opsfileYML, filepath.Join(opluginsTestDir, "opsfile.yml"))
require.NoError(t, err)
- return olarisTestDir
+ return opluginsTestDir
}
func TestGetAllOpsRootPlugins(t *testing.T) {
@@ -83,29 +83,29 @@ func TestGetAllOpsRootPlugins(t *testing.T) {
os.Setenv("OPS_ROOT_PLUGIN", tempDir)
plgFolder := setupPluginTest(tempDir, t)
- // create the olaris-test2 folder
- olarisTestDir := filepath.Join(tempDir, "olaris-test2")
- err := os.MkdirAll(olarisTestDir, 0755)
+ // create the oplugins-test2 folder
+ opluginsTestDir := filepath.Join(tempDir, "oplugins-test2")
+ err := os.MkdirAll(opluginsTestDir, 0755)
require.NoError(t, err)
- // copy the opsroot.json from tests/olaris into the olaris-test folder
- opsRootJSON := filepath.Join("tests", "olaris", "opsroot.json")
- err = copyFile(opsRootJSON, filepath.Join(olarisTestDir, "opsroot.json"))
+ // copy the opsroot.json from tests/oplugins into the oplugins-test folder
+ opsRootJSON := filepath.Join("tests", "oplugins", "opsroot.json")
+ err = copyFile(opsRootJSON, filepath.Join(opluginsTestDir, "opsroot.json"))
require.NoError(t, err)
- // copy opsfile.yml from tests/olaris into the olaris-test folder
- opsfileYML := filepath.Join("tests", "olaris", "opsfile.yml")
- err = copyFile(opsfileYML, filepath.Join(olarisTestDir, "opsfile.yml"))
+ // copy opsfile.yml from tests/oplugins into the oplugins-test folder
+ opsfileYML := filepath.Join("tests", "oplugins", "opsfile.yml")
+ err = copyFile(opsfileYML, filepath.Join(opluginsTestDir, "opsfile.yml"))
require.NoError(t, err)
opsRoots, err := GetOpsRootPlugins()
require.NoError(t, err)
require.Len(t, opsRoots, 2)
require.Equal(t, joinpath(plgFolder, OPSROOT), opsRoots[getPluginName(plgFolder)])
- require.Equal(t, joinpath(olarisTestDir, OPSROOT), opsRoots[getPluginName(olarisTestDir)])
+ require.Equal(t, joinpath(opluginsTestDir, OPSROOT), opsRoots[getPluginName(opluginsTestDir)])
})
- t.Run("empty: no plugins folder found (olaris-*)", func(t *testing.T) {
+ t.Run("empty: no plugins folder found (oplugins-*)", func(t *testing.T) {
tempDir := t.TempDir()
os.Setenv("OPS_ROOT_PLUGIN", tempDir)
@@ -117,7 +117,7 @@ func TestGetAllOpsRootPlugins(t *testing.T) {
}
func TestFindPluginTask(t *testing.T) {
- t.Run("success: plugin task found in ./olaris-test", func(t *testing.T) {
+ t.Run("success: plugin task found in ./oplugins-test", func(t *testing.T) {
tempDir := t.TempDir()
os.Setenv("OPS_ROOT_PLUGIN", tempDir)
plgFolder := setupPluginTest(tempDir, t)
@@ -127,7 +127,7 @@ func TestFindPluginTask(t *testing.T) {
require.Equal(t, plgFolder, fld)
})
- t.Run("error: no plugins folder found (olaris-*)", func(t *testing.T) {
+ t.Run("error: no plugins folder found (oplugins-*)", func(t *testing.T) {
tempDir := t.TempDir()
os.Setenv("OPS_ROOT_PLUGIN", tempDir)
@@ -179,14 +179,14 @@ func TestCheckGitRepo(t *testing.T) {
expectedName string
}{
{
- url: "https://github.com/giusdp/olaris-test",
+ url: "https://github.com/giusdp/oplugins-test",
expectedRepo: true,
- expectedName: "olaris-test",
+ expectedName: "oplugins-test",
},
{
- url: "https://github.com/giusdp/olaris-test.git",
+ url: "https://github.com/giusdp/oplugins-test.git",
expectedRepo: true,
- expectedName: "olaris-test",
+ expectedName: "oplugins-test",
},
{
url: "https://github.com/giusdp/some-repo",
@@ -194,12 +194,12 @@ func TestCheckGitRepo(t *testing.T) {
expectedName: "",
},
{
- url: "https://github.com/giusdp/olaris-repo.git",
+ url: "https://github.com/giusdp/oplugins-repo.git",
expectedRepo: true,
- expectedName: "olaris-repo",
+ expectedName: "oplugins-repo",
},
{
- url: "https://github.com/olaris-1234/repo",
+ url: "https://github.com/oplugins-1234/repo",
expectedRepo: false,
expectedName: "",
},
@@ -211,9 +211,9 @@ func TestCheckGitRepo(t *testing.T) {
}
for _, test := range tests {
- isOlarisRepo, repoName := checkGitRepo(test.url)
+ isOpluginsRepo, repoName := checkGitRepo(test.url)
require.Equal(t, test.expectedName, repoName)
- require.Equal(t, test.expectedRepo, isOlarisRepo)
+ require.Equal(t, test.expectedRepo, isOpluginsRepo)
}
}
@@ -224,11 +224,11 @@ func Test_getPluginName(t *testing.T) {
expected string
}{
{
- name: "olaris-test",
+ name: "oplugins-test",
expected: "test",
},
{
- name: "olaris-test-123",
+ name: "oplugins-test-123",
expected: "test-123",
},
{
@@ -236,7 +236,7 @@ func Test_getPluginName(t *testing.T) {
expected: "test",
},
{
- name: "a/fake/path/to/olaris-test",
+ name: "a/fake/path/to/oplugins-test",
expected: "test",
},
}
diff --git a/prepare_test.go b/prepare_test.go
index 7e9c1d8..b84c4c5 100644
--- a/prepare_test.go
+++ b/prepare_test.go
@@ -28,14 +28,14 @@ func Example_locate() {
_ = os.Chdir(workDir)
dir, err := locateOpsRoot("tests")
pr(1, err, npath(dir))
- dir, err = locateOpsRoot(joinpath("tests", "olaris"))
+ dir, err = locateOpsRoot(joinpath("tests", "oplugins"))
pr(2, err, npath(dir))
- dir, err = locateOpsRoot(joinpath("tests", joinpath("olaris", "sub")))
+ dir, err = locateOpsRoot(joinpath("tests", joinpath("oplugins", "sub")))
pr(3, err, npath(dir))
// Output:
- // 1 <nil> /work/tests/olaris
- // 2 <nil> /work/tests/olaris
- // 3 <nil> /work/tests/olaris
+ // 1 <nil> /work/tests/oplugins
+ // 2 <nil> /work/tests/oplugins
+ // 3 <nil> /work/tests/oplugins
}
// TODO: undestand why it fails when executed with others
@@ -72,7 +72,7 @@ func Example_locate_root() {
pr(2, err, npath(dir))
// Output:
// 1 cannot find opsfiles, download them with ops -update
- // 2 <nil> /work/tests/olaris
+ // 2 <nil> /work/tests/oplugins
}
func Test_setOpsOlarisHash(t *testing.T) {
diff --git a/prereq_test.go b/prereq_test.go
index 13c6138..cbe934b 100644
--- a/prereq_test.go
+++ b/prereq_test.go
@@ -35,7 +35,7 @@ func Example_loadPrereq() {
t, v, err := loadPrereq(dir)
fmt.Println(err, len(t), len(v))
dir = joinpath(dir, "prereq")
- //dir = "/home/msciab/.ops/0.1.0/olaris/"
+ //dir = "/home/msciab/.ops/0.1.0/oplugins/"
tasks, versions, err := loadPrereq(dir)
//fmt.Println(prq)
fmt.Println(err, tasks)
diff --git a/serve_test.go b/serve_test.go
index ed035db..2bbd20b 100644
--- a/serve_test.go
+++ b/serve_test.go
@@ -30,7 +30,7 @@ import (
func TestIndex(t *testing.T) {
_ = os.Chdir(workDir)
- webDir, _ := filepath.Abs(filepath.Join("tests", "olaris", "web"))
+ webDir, _ := filepath.Abs(filepath.Join("tests", "oplugins", "web"))
handler := webFileServerHandler(webDir)
ts := httptest.NewServer(handler)
defer ts.Close()
diff --git a/tests/auto_setup.bats b/tests/auto_setup.bats
index 2fe2975..48884f8 100644
--- a/tests/auto_setup.bats
+++ b/tests/auto_setup.bats
@@ -20,7 +20,8 @@ setup() {
load 'test_helper/bats-assert/load'
export NO_COLOR=1
cd testdata
- ops -reset force
+ #ops -reset force
+ ops -reset clean
}
@test "first run auto setups" {
diff --git a/tests/help.bats b/tests/help.bats
index b59112a..004bac5 100644
--- a/tests/help.bats
+++ b/tests/help.bats
@@ -19,8 +19,9 @@ setup() {
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'
export NO_COLOR=1
- EXPECTED_VERSION="$(tr -d '\r\n' < ../version.txt)"
- EXPECTED_BRANCH="$(tr -d '\r\n' < ../branch.txt)"
+ # the files carry an Apache license header: the value is the last non-empty line
+ EXPECTED_VERSION="$(grep -v '^#' ../version.txt | tr -d '\r\n')"
+ EXPECTED_BRANCH="$(grep -v '^#' ../branch.txt | tr -d '\r\n')"
#ops -reset force
ops -reset clean
cd ..
diff --git a/tests/info.bats b/tests/info.bats
index 264ed16..48bae97 100644
--- a/tests/info.bats
+++ b/tests/info.bats
@@ -35,7 +35,7 @@ setup() {
WD=$(pwd)
assert_line "OPS_VERSION: test"
assert_line "OPS_PWD: $WD"
- assert_line "OPS_ROOT: $WD/olaris"
+ assert_line "OPS_ROOT: $WD/oplugins"
assert_line "OPS_TMP: $HOME/.ops/tmp"
assert_line --partial "OPS_TASKS: "
assert_success
diff --git a/tests/oplugins/README.md b/tests/oplugins/README.md
index 8ca4291..0624fa6 100644
--- a/tests/oplugins/README.md
+++ b/tests/oplugins/README.md
@@ -17,9 +17,9 @@
~ under the License.
~
-->
-# Welcome to olaris
+# Welcome to oplugins
-What is this? Is ops's olaris, aka tasks for ops.
+What is this? Is ops's oplugins, aka tasks for ops.
In other words, the scripts executed by `ops`.
diff --git a/tests/plugin.bats b/tests/plugin.bats
index a4e56ad..88b1bfd 100644
--- a/tests/plugin.bats
+++ b/tests/plugin.bats
@@ -19,7 +19,8 @@ setup() {
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'
export NO_COLOR=1
- export OPS_BRANCH="$(cat ../branch.txt)"
+ # branch.txt carries an Apache license header: skip comment lines
+ export OPS_BRANCH="$(grep -v '^#' ../branch.txt | tr -d '\r\n')"
run rm -rf ~/.ops/$OPS_BRANCH
}
@@ -30,10 +31,10 @@ setup() {
}
@test "ops skips invalid plugin folders (without opsfile.yml)" {
- run mkdir olaris-test2
+ run mkdir oplugins-test2
run ops -t
refute_line " test2 (local)"
- run rm -rf olaris-test2
+ run rm -rf oplugins-test2
}
@test "ops help on sub cmds plugin" {
@@ -58,7 +59,7 @@ setup() {
assert_line 'PLUGIN_ANOTHER_KEY=a plugin value'
}
-@test "other plugin without olaris is shown" {
+@test "other plugin without oplugins is shown" {
cd testdata
run ops -update
run ops -t
@@ -95,7 +96,7 @@ setup() {
assert_line "error: plugin repository must be a https url and plugin must start with 'oplugins-' or 'olaris-'"
assert_failure
- run ops -plugin olaris-test
+ run ops -plugin oplugins-test
assert_line "error: plugin repository must be a https url and plugin must start with 'oplugins-' or 'olaris-'"
assert_failure
}
diff --git a/tests/prereq_yml.bats b/tests/prereq_yml.bats
index f92b76a..1e48464 100644
--- a/tests/prereq_yml.bats
+++ b/tests/prereq_yml.bats
@@ -27,7 +27,7 @@ setup() {
@test "OS=linux ARCH=amd64" {
OS=linux ARCH=amd64
mkdir -p _bin/$OS-$ARCH
- run env __OS=$OS __ARCH=$ARCH task -t prereq/olaris/prereq.yml -d _bin/$OS-$ARCH all
+ run env __OS=$OS __ARCH=$ARCH task -t prereq/oplugins/prereq.yml -d _bin/$OS-$ARCH all
find _bin/$OS-$ARCH -type f | xargs file | grep ELF | grep x86-64 | wc -l | xargs | tee _count
assert_equal "$(cat _count)" $COUNT
}
@@ -35,7 +35,7 @@ setup() {
@test "OS=linux ARCH=arm64" {
OS=linux ARCH=arm64
mkdir -p _bin/$OS-$ARCH
- run env __OS=$OS __ARCH=$ARCH task -t prereq/olaris/prereq.yml -d _bin/$OS-$ARCH all
+ run env __OS=$OS __ARCH=$ARCH task -t prereq/oplugins/prereq.yml -d _bin/$OS-$ARCH all
find _bin/$OS-$ARCH -type f | xargs file | grep ELF | grep ARM | wc -l | xargs | tee _count
assert_equal "$(cat _count)" $COUNT
}
@@ -43,7 +43,7 @@ setup() {
@test "OS=darwin ARCH=amd64" {
OS=darwin ARCH=amd64
mkdir -p _bin/$OS-$ARCH
- run env __OS=$OS __ARCH=$ARCH task -t prereq/olaris/prereq.yml -d _bin/$OS-$ARCH all
+ run env __OS=$OS __ARCH=$ARCH task -t prereq/oplugins/prereq.yml -d _bin/$OS-$ARCH all
find _bin/$OS-$ARCH -type f | xargs file | head -n 1 | grep Mach-O | grep x86_64 | wc -l | xargs | tee _count
assert_equal "$(cat _count)" $COUNT
}
@@ -51,7 +51,7 @@ setup() {
@test "OS=darwin ARCH=arm64" {
OS=darwin ARCH=arm64
mkdir -p _bin/$OS-$ARCH
- run env __OS=$OS __ARCH=$ARCH task -t prereq/olaris/prereq.yml -d _bin/$OS-$ARCH all
+ run env __OS=$OS __ARCH=$ARCH task -t prereq/oplugins/prereq.yml -d _bin/$OS-$ARCH all
find _bin/$OS-$ARCH -type f | xargs file | head -n 1 | grep Mach-O | grep arm64 | wc -l | xargs | tee _count
assert_equal "$(cat _count)" $COUNT
}
@@ -59,7 +59,7 @@ setup() {
@test "OS=windows ARCH=amd64" {
OS=windows ARCH=amd64
mkdir -p _bin/$OS-$ARCH
- run env __OS=$OS __ARCH=$ARCH task -t prereq/olaris/prereq.yml -d _bin/$OS-$ARCH __OS=$OS __ARCH=$ARCH all
+ run env __OS=$OS __ARCH=$ARCH task -t prereq/oplugins/prereq.yml -d _bin/$OS-$ARCH __OS=$OS __ARCH=$ARCH all
find _bin/$OS-$ARCH -type f | xargs file | grep PE32 | wc -l | xargs | tee _count
assert_equal "$(cat _count)" $COUNT
}
diff --git a/tests/update_branch.bats b/tests/update_branch.bats
index 55ac90f..1b1e426 100644
--- a/tests/update_branch.bats
+++ b/tests/update_branch.bats
@@ -19,7 +19,8 @@ setup() {
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'
export NO_COLOR=1
- export OPS_BRANCH="$(cat ../branch.txt)"
+ # branch.txt carries an Apache license header: skip comment lines
+ export OPS_BRANCH="$(grep -v '^#' ../branch.txt | tr -d '\r\n')"
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
diff --git a/updates_check_test.go b/updates_check_test.go
index 6a6ce05..b874c88 100644
--- a/updates_check_test.go
+++ b/updates_check_test.go
@@ -77,7 +77,7 @@ func resetOneCommit(repo *git.Repository) {
}
func Example_checkUpdated_uptodate() {
- // clone olaris folder into a temp folder
+ // clone oplugins folder into a temp folder
tmpDir, err := os.MkdirTemp("", "ops-test")
if err != nil {
pr("failed to create temp dir", err)
@@ -112,7 +112,7 @@ func Example_checkUpdated_uptodate() {
}
func Example_checkUpdated_outdated() {
- // clone olaris folder into a temp folder
+ // clone oplugins folder into a temp folder
tmpDir, err := os.MkdirTemp("", "ops-test")
if err != nil {
pr("failed to create temp dir", err)
@@ -139,7 +139,7 @@ func Example_checkUpdated_outdated() {
// change latest_check file mtime to 2 seconds ago
changeLatestCheckTime(tmpDirBranch, -2*time.Second)
- // git reset olaris to a previous commit
+ // git reset oplugins to a previous commit
resetOneCommit(repo)
// re-run checkUpdated and check output