mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-11-12 00:52:11 +01:00
Corrections after first run
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestConfigPathFromArgs(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args []string
|
||||
defaultPath string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "default path",
|
||||
args: []string{"serve"},
|
||||
defaultPath: "config.jsonc",
|
||||
want: "config.jsonc",
|
||||
},
|
||||
{
|
||||
name: "config after serve",
|
||||
args: []string{"serve", "--config", "/etc/archivist/custom.jsonc"},
|
||||
defaultPath: "config.jsonc",
|
||||
want: "/etc/archivist/custom.jsonc",
|
||||
},
|
||||
{
|
||||
name: "config among PocketBase flags",
|
||||
args: []string{"serve", "--http=127.0.0.1:8090", "--config=/etc/archivist/custom.jsonc"},
|
||||
defaultPath: "config.jsonc",
|
||||
want: "/etc/archivist/custom.jsonc",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := configPathFromArgs(tt.args, tt.defaultPath)
|
||||
if err != nil {
|
||||
t.Fatalf("configPathFromArgs() error = %v", err)
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Errorf("configPathFromArgs() = %q, want %q", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user