Skip to content

Commit 2c34156

Browse files
cleaup and add config tests
1 parent 0544b4c commit 2c34156

File tree

5 files changed

+9
-48
lines changed

5 files changed

+9
-48
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,5 @@ jobs:
1515
- name: Check out code
1616
uses: actions/checkout@v1
1717

18-
- name: Build
19-
run: make build
20-
2118
- name: Test
22-
run: bats ./test/test.bats
19+
run: make integration-test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin/
22
tmp/
3-
.DS_Store
3+
.DS_Store
4+
config.yaml

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ run: clean build config ## Run the smolgit `make run`
3434
test: ## Run the tests of the smolgit
3535
$(GOTEST) -v -race ./...
3636

37+
integration-test: build ## Run the bats tests of the smolgit
38+
@bats ./test/test.bats
39+
3740
## Help:
3841
help: ## Show this help.
3942
@echo ''

config.yaml

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +0,0 @@
1-
log:
2-
# Color log output
3-
color: true
4-
# Log as json
5-
json: false
6-
# Log level (INFO, DEBUG, TRACE, WARN)
7-
level: DEBUG
8-
server:
9-
# Disable web server
10-
disabled: false
11-
# Enable basic http auth
12-
auth:
13-
enabled: false
14-
# Credentials for basic auth
15-
accounts:
16-
- login: user2
17-
password: bar
18-
- login: user1
19-
password: foo
20-
# Web server address
21-
addr: ":3080"
22-
# Navbar brand string
23-
brand: "smolgit"
24-
ssh:
25-
# SSH server address
26-
addr: ":3081"
27-
git:
28-
# Folder to save git repositories
29-
path: /tmp/smolgit
30-
# Base for clone string formating
31-
# (e.g. ssh://git@my-git-server.lan/myuser/project.git)
32-
base: "git@my-git-server.lan"
33-
users:
34-
# User name used for folder in git.path
35-
- name: "bob"
36-
# Permissions, wildcard or regex
37-
# User to check access for other repositories
38-
# '*' - access for all repositories
39-
# 'admin' - access for admin's repositories
40-
# '(admin|billy)' - access for admin's and billy's repositories
41-
permissions: "*"
42-
keys:
43-
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCq9rD9b8tYyuSLsTECHCn... developer@mail.com

test/test.bats

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
}
77

88
@test "can generate config" {
9+
export config=./config.yaml
910
run ./bin/smolgit config
1011
[ "${lines[0]}" = "log:" ]
12+
run ./bin/smolgit config > "$config"
13+
test -f "$config"
1114
}

0 commit comments

Comments
 (0)