Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
target-branch: main
38 changes: 38 additions & 0 deletions .github/workflows/local-test-on-mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:
test-packages:
name: test-local-brew
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-13, macos-14, macos-latest]
runs-on: ${{ matrix.os }}
env:
TERM: xterm
steps:
- uses: actions/checkout@v2
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Brew version output
run: brew --version
- name: INSTALL bats-core
run: |
brew list bats && brew uninstall bats || echo "bats is not present"
brew install bats-core
- name: INSTALL bats-libraries
run: |
brew tap bats-core/bats-core
brew install bats-support
brew install bats-assert
brew install bats-file
brew install bats-detik
- name: LOCAL TEST
run: |
bats -T -p tests
7 changes: 5 additions & 2 deletions .github/workflows/test-brew-formulae.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-bats-libs-formulae
name: CI

on:
push:
Expand All @@ -8,13 +8,16 @@ on:

jobs:
test-packages:
name: test-formulae
strategy:
fail-fast: false
matrix:
package: [bats-support, bats-assert, bats-detik, bats-file]
runs-on: macos-latest
os: [macos-12, macos-13, macos-14, macos-latest]
runs-on: ${{ matrix.os }}
env:
PACKAGE: ${{ matrix.package }}
TERM: xterm
steps:
- uses: actions/checkout@v2
- name: Set up Homebrew
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.28.4
hooks:
- id: check-github-workflows
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: detect-private-key
- id: trailing-whitespace
- id: end-of-file-fixer
4 changes: 2 additions & 2 deletions Formula/bats-detik.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class BatsDetik < Formula
desc "Library to ease e2e tests of applications in K8s environments"
homepage "https://github.com/bats-core/bats-detik"
url "https://github.com/bats-core/bats-detik/archive/refs/tags/v1.3.1.tar.gz"
sha256 "1cf48a74c505d95950c45bab757fd4a65040aa6766889f0be8f54279827b9bff"
url "https://github.com/bats-core/bats-detik/archive/refs/tags/v1.3.2.tar.gz"
sha256 "cb95587cd0e493595eef725339c2d5aa1ad824f459c6e53a9a378e7966008773"
license "MIT"
head "https://github.com/bats-core/bats-detik.git", branch: "master"

Expand Down
72 changes: 72 additions & 0 deletions tests/1-example-tests.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
setup() {
load 'tests_helper'
_tests_helper
}


@test "0: Pre: Create file and dir" {
run mkdir testing
run touch testing/example
assert_success
}

#bats test_tags=github:true
@test "1: Testing file existence" {
run ls testing/example
assert_success
[ -f "testing/example" ]
assert_success
}

#bats test_tags=github:true
@test "2: Testing file permissions" {
run stat -f%p testing/example
assert_success
assert_output 100644
assert_file_permission 644 testing/example
assert_success
}

#bats test_tags=github:true
@test "3: Testing file content" {
run cat testing/example
assert_success
refute_output "Expected content"
assert_file_empty testing/example
assert_success
}

#bats test_tags=github:true
@test "4: Testing directory creation" {
run mkdir testing/newdir
[ -d "testing/newdir" ]
assert_success
}

#bats test_tags=github:true
@test "5: Testing file creation inside directory" {
run touch testing/newdir/newfile
[ -f "testing/newdir/newfile" ]
assert_success
}

#bats test_tags=github:true
@test "6: Testing file deletion" {
run rm testing/newdir/newfile
[ ! -f "testing/newdir/newfile" ]
assert_success
}

#bats test_tags=github:true
@test "7: Testing directory deletion" {
run rmdir testing/newdir
[ ! -d "testing/newdir" ]
assert_success
}

#bats test_tags=github:true
@test "8: Testing file deletion" {
run rm testing/example
[ ! -f "testing/example" ]
assert_success
}
8 changes: 8 additions & 0 deletions tests/tests_helper.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_tests_helper() {
_BREW_PREFIX="$(brew --prefix)"
export BATS_LIB_PATH="${BATS_LIB_PATH}:${_BREW_PREFIX}/lib"
bats_load_library bats-support
bats_load_library bats-assert
bats_load_library bats-file
bats_load_library bats-detik/detik.bash
}