Skip to content

Commit b187083

Browse files
committed
update detik to 1.3.2, add pre-commit, add tests, add dependabot, add macos matrix
1 parent c4caa55 commit b187083

File tree

7 files changed

+143
-4
lines changed

7 files changed

+143
-4
lines changed

.github/dependabot.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
target-branch: main
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
test-packages:
11+
name: test-local-brew
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [macos-12, macos-13, macos-14, macos-latest]
16+
runs-on: ${{ matrix.os }}
17+
env:
18+
TERM: xterm
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Homebrew
22+
uses: Homebrew/actions/setup-homebrew@master
23+
- name: Brew version output
24+
run: brew --version
25+
- name: INSTALL bats-core
26+
run: |
27+
brew list bats && brew uninstall bats || echo "bats is not present"
28+
brew install bats-core
29+
- name: INSTALL bats-libraries
30+
run: |
31+
brew tap bats-core/bats-core
32+
brew install bats-support
33+
brew install bats-assert
34+
brew install bats-file
35+
brew install bats-detik
36+
- name: LOCAL TEST
37+
run: |
38+
bats -T -p tests

.github/workflows/test-brew-formulae.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test-bats-libs-formulae
1+
name: CI
22

33
on:
44
push:
@@ -8,13 +8,16 @@ on:
88

99
jobs:
1010
test-packages:
11+
name: test-formulae
1112
strategy:
1213
fail-fast: false
1314
matrix:
1415
package: [bats-support, bats-assert, bats-detik, bats-file]
15-
runs-on: macos-latest
16+
os: [macos-12, macos-13, macos-14, macos-latest]
17+
runs-on: ${{ matrix.os }}
1618
env:
1719
PACKAGE: ${{ matrix.package }}
20+
TERM: xterm
1821
steps:
1922
- uses: actions/checkout@v2
2023
- name: Set up Homebrew

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
repos:
2+
- repo: https://github.com/sirosen/check-jsonschema
3+
rev: 0.28.4
4+
hooks:
5+
- id: check-github-workflows
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.6.0
8+
hooks:
9+
- id: detect-private-key
10+
- id: trailing-whitespace
11+
- id: end-of-file-fixer

Formula/bats-detik.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class BatsDetik < Formula
22
desc "Library to ease e2e tests of applications in K8s environments"
33
homepage "https://github.com/bats-core/bats-detik"
4-
url "https://github.com/bats-core/bats-detik/archive/refs/tags/v1.3.1.tar.gz"
5-
sha256 "1cf48a74c505d95950c45bab757fd4a65040aa6766889f0be8f54279827b9bff"
4+
url "https://github.com/bats-core/bats-detik/archive/refs/tags/v1.3.2.tar.gz"
5+
sha256 "cb95587cd0e493595eef725339c2d5aa1ad824f459c6e53a9a378e7966008773"
66
license "MIT"
77
head "https://github.com/bats-core/bats-detik.git", branch: "master"
88

tests/1-example-tests.bats

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
setup() {
2+
load 'tests_helper'
3+
_tests_helper
4+
}
5+
6+
7+
@test "0: Pre: Create file and dir" {
8+
run mkdir testing
9+
run touch testing/example
10+
assert_success
11+
}
12+
13+
#bats test_tags=github:true
14+
@test "1: Testing file existence" {
15+
run ls testing/example
16+
assert_success
17+
[ -f "testing/example" ]
18+
assert_success
19+
}
20+
21+
#bats test_tags=github:true
22+
@test "2: Testing file permissions" {
23+
run stat -f%p testing/example
24+
assert_success
25+
assert_output 100644
26+
assert_file_permission 644 testing/example
27+
assert_success
28+
}
29+
30+
#bats test_tags=github:true
31+
@test "3: Testing file content" {
32+
run cat testing/example
33+
assert_success
34+
refute_output "Expected content"
35+
assert_file_empty testing/example
36+
assert_success
37+
}
38+
39+
#bats test_tags=github:true
40+
@test "4: Testing directory creation" {
41+
run mkdir testing/newdir
42+
[ -d "testing/newdir" ]
43+
assert_success
44+
}
45+
46+
#bats test_tags=github:true
47+
@test "5: Testing file creation inside directory" {
48+
run touch testing/newdir/newfile
49+
[ -f "testing/newdir/newfile" ]
50+
assert_success
51+
}
52+
53+
#bats test_tags=github:true
54+
@test "6: Testing file deletion" {
55+
run rm testing/newdir/newfile
56+
[ ! -f "testing/newdir/newfile" ]
57+
assert_success
58+
}
59+
60+
#bats test_tags=github:true
61+
@test "7: Testing directory deletion" {
62+
run rmdir testing/newdir
63+
[ ! -d "testing/newdir" ]
64+
assert_success
65+
}
66+
67+
#bats test_tags=github:true
68+
@test "8: Testing file deletion" {
69+
run rm testing/example
70+
[ ! -f "testing/example" ]
71+
assert_success
72+
}

tests/tests_helper.bash

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_tests_helper() {
2+
_BREW_PREFIX="$(brew --prefix)"
3+
export BATS_LIB_PATH="${BATS_LIB_PATH}:${_BREW_PREFIX}/lib"
4+
bats_load_library bats-support
5+
bats_load_library bats-assert
6+
bats_load_library bats-file
7+
bats_load_library bats-detik/detik.bash
8+
}

0 commit comments

Comments
 (0)