Skip to content

Commit 97c381e

Browse files
fix: all the tests passing
1 parent 1c657b8 commit 97c381e

10 files changed

Lines changed: 21 additions & 34 deletions

File tree

Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ tasks:
3636
- echo "{{.BASEVER}}-$(date +%y%m%d%H%M).{{.VARIANT}}" >version.txt
3737
- echo "{{.BASEVER}}" >branch.txt
3838
- git add version.txt branch.txt
39-
- git commit -m "version files"
39+
- git commit -m "$(cat version.txt)"
4040
- git tag -f "v$(cat version.txt)"
4141

4242

4343
trigger:
44-
desc: create tag, and push triggering a build
44+
desc: create tag and push triggering a build
4545
prompt: did you commit everyting?
4646
cmds:
4747
- git diff --exit-code
@@ -56,7 +56,7 @@ tasks:
5656
desc: build ops locally
5757
cmds:
5858
- echo building {{.VERSION}}
59-
- go build {{.DEBUG}} cmd/ops/ops.go
59+
- go build {{.DEBUG}} ./cmd/ops/
6060
sources:
6161
- "*.go"
6262
- "*/*.go"

cmd/ops/ops.go

Lines changed: 0 additions & 7 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

prepare.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func locateOpsRoot(cur string) (string, error) {
191191
return olaris, nil
192192
}
193193

194-
return "", fmt.Errorf("we cannot find opsfiles, download them with ops -update")
194+
return "", fmt.Errorf("cannot find opsfiles, download them with ops -update")
195195
}
196196

197197
// locateOpsRootSearch search for `opsfiles.yml`

prepare_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ func Example_locate() {
4040

4141
// TODO: undestand why it fails when executed with others
4242
// it works executed alone
43-
func Failing_Example_download() {
44-
pr(1)
43+
func Example_download() {
4544
_ = os.Chdir(workDir)
4645
OpsBranch = "0.1.0"
4746
opsdir, _ := homedir.Expand("~/.ops")
@@ -53,7 +52,6 @@ func Failing_Example_download() {
5352
dir, err = locateOpsRoot(".")
5453
pr(2, err, nhpath(dir))
5554
// Output:
56-
// 1
5755
// Cloning tasks...
5856
// Tasks downloaded successfully
5957
// 1 <nil> /home/.ops/0.1.0/olaris
@@ -73,7 +71,7 @@ func Example_locate_root() {
7371
dir, err := locateOpsRoot("tests")
7472
pr(2, err, npath(dir))
7573
// Output:
76-
// 1 we cannot find opsfiles, download them with ops -update
74+
// 1 cannot find opsfiles, download them with ops -update
7775
// 2 <nil> /work/tests/olaris
7876
}
7977

tests/login.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ setup() {
5757
export OPS_APIHOST=localhost
5858
export OPS_PASSWORD=1234
5959
run ops -login
60-
assert_line "Logging in as opsolaris to localhost"
60+
assert_line "Logging in as nuvolaris to localhost"
6161
}
6262

6363
@test "ops -login with OPS_APIHOST and OPS_USER env" {

tests/plugin.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ setup() {
101101
}
102102

103103
@test "ops -plugin with correct plugin repo" {
104-
run ops -plugin https://github.com/giusdp/olaris-test.git
104+
run ops -plugin https://github.com/sciabarracom/olaris-test.git
105105
assert_success
106106

107107
run ops

tests/update.bats

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,24 @@ setup() {
1919
load 'test_helper/bats-support/load'
2020
load 'test_helper/bats-assert/load'
2121
export NO_COLOR=1
22+
rm -rf ~/.ops
23+
cd ..
2224
}
2325

24-
@test "ops -update" {
25-
run rm -rf ~/.ops
26+
@test "ops -update and versions" {
2627
run ops -update
2728
assert_success
2829
assert_line "Tasks downloaded successfully"
29-
assert_line "ensuring prerequisite coreutils"
30-
}
30+
assert_line --partial "ensuring prerequisite coreutils"
3131

32-
@test "ops -update with old version warns" {
3332
OPS_VERSION=0.0.0 run ops -update
3433
assert_line --partial "Your ops version (0.0.0) is older than the required version"
3534
assert_line "Trying to update ops..."
36-
#assert_success
35+
assert_success
36+
37+
OPS_VERSION=10.2.3 run ops -update
38+
assert_line "Tasks are already up to date!"
39+
assert_success
3740
}
3841

3942
@test "ops -update with bad version" {
@@ -42,16 +45,8 @@ setup() {
4245
assert_success
4346
}
4447

45-
@test "ops -update with newer version" {
46-
OPS_VERSION=10.2.3 run ops -update
47-
assert_line "Tasks are already up to date!"
48-
assert_success
49-
}
50-
5148
@test "ops -update on branch" {
52-
run rm -rf ~/.ops
53-
export OPS_BRANCH=0.1.0
54-
run ops -update
49+
OPS_BRANCH=main run ops -update
5550
assert_line "Tasks downloaded successfully"
5651
assert_success
5752
}

tests/update_branch.bats

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ setup() {
2121
export NO_COLOR=1
2222
export OPS_BRANCH="$(cat ../branch.txt)"
2323
rm -rf ~/.ops
24-
run ops -update
24+
ops -update
2525
cd ~/.ops/$OPS_BRANCH/olaris
26+
ops -info
2627
}
2728

2829
@test "ops -update on olaris with old commit updates correctly" {
@@ -31,7 +32,7 @@ setup() {
3132
assert_line --partial "Your branch is behind"
3233

3334
run ops -update
34-
assert_line "Tasks updated successfully"
35+
assert_line --partial "Tasks updated successfully"
3536
assert_success
3637

3738
run git status

0 commit comments

Comments
 (0)