From 2c34156db7f6f6cf4a36bf7cd0d4f5ff17f40d22 Mon Sep 17 00:00:00 2001 From: roman-kiselenko Date: Sat, 20 Jul 2024 10:11:05 +0300 Subject: [PATCH] cleaup and add config tests --- .github/workflows/test.yml | 5 +---- .gitignore | 3 ++- Makefile | 3 +++ config.yaml | 43 -------------------------------------- test/test.bats | 3 +++ 5 files changed, 9 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ab11c8..ceb5fdc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,8 +15,5 @@ jobs: - name: Check out code uses: actions/checkout@v1 - - name: Build - run: make build - - name: Test - run: bats ./test/test.bats \ No newline at end of file + run: make integration-test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 503c38c..0717175 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin/ tmp/ -.DS_Store \ No newline at end of file +.DS_Store +config.yaml \ No newline at end of file diff --git a/Makefile b/Makefile index c6ac204..c4c9672 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ run: clean build config ## Run the smolgit `make run` test: ## Run the tests of the smolgit $(GOTEST) -v -race ./... +integration-test: build ## Run the bats tests of the smolgit + @bats ./test/test.bats + ## Help: help: ## Show this help. @echo '' diff --git a/config.yaml b/config.yaml index 67ba21e..e69de29 100644 --- a/config.yaml +++ b/config.yaml @@ -1,43 +0,0 @@ -log: - # Color log output - color: true - # Log as json - json: false - # Log level (INFO, DEBUG, TRACE, WARN) - level: DEBUG -server: - # Disable web server - disabled: false - # Enable basic http auth - auth: - enabled: false - # Credentials for basic auth - accounts: - - login: user2 - password: bar - - login: user1 - password: foo - # Web server address - addr: ":3080" - # Navbar brand string - brand: "smolgit" -ssh: - # SSH server address - addr: ":3081" -git: - # Folder to save git repositories - path: /tmp/smolgit - # Base for clone string formating - # (e.g. ssh://git@my-git-server.lan/myuser/project.git) - base: "git@my-git-server.lan" - users: - # User name used for folder in git.path - - name: "bob" - # Permissions, wildcard or regex - # User to check access for other repositories - # '*' - access for all repositories - # 'admin' - access for admin's repositories - # '(admin|billy)' - access for admin's and billy's repositories - permissions: "*" - keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCq9rD9b8tYyuSLsTECHCn... developer@mail.com \ No newline at end of file diff --git a/test/test.bats b/test/test.bats index f7aea51..aacbfbf 100644 --- a/test/test.bats +++ b/test/test.bats @@ -6,6 +6,9 @@ } @test "can generate config" { + export config=./config.yaml run ./bin/smolgit config [ "${lines[0]}" = "log:" ] + run ./bin/smolgit config > "$config" + test -f "$config" } \ No newline at end of file