Skip to content

Commit

Permalink
cleaup and add config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-kiselenko committed Jul 20, 2024
1 parent 0544b4c commit 2c34156
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 48 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
run: make integration-test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/
tmp/
.DS_Store
.DS_Store
config.yaml
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down
43 changes: 0 additions & 43 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -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://[email protected]/myuser/project.git)
base: "[email protected]"
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... [email protected]
3 changes: 3 additions & 0 deletions test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 2c34156

Please sign in to comment.