mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 02:24:24 +00:00
Config: Add "test-hub" target to Makefile and improve log messages
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
47b7a0faf7
commit
fba00a843c
3 changed files with 11 additions and 7 deletions
4
Makefile
4
Makefile
|
|
@ -73,6 +73,7 @@ build-all: build-go build-js
|
|||
pull: docker-pull
|
||||
test: test-js test-go
|
||||
test-go: run-test-go
|
||||
test-hub: run-test-hub
|
||||
test-pkg: run-test-pkg
|
||||
test-ai: run-test-ai
|
||||
test-api: run-test-api
|
||||
|
|
@ -403,6 +404,9 @@ run-test-short:
|
|||
run-test-go:
|
||||
$(info Running all Go tests...)
|
||||
$(GOTEST) -parallel 1 -count 1 -cpu 1 -tags="slow,develop" -timeout 20m ./pkg/... ./internal/...
|
||||
run-test-hub:
|
||||
$(info Running all Go tests with hub requests...)
|
||||
env PHOTOPRISM_TEST_HUB="true" $(GOTEST) -parallel 1 -count 1 -cpu 1 -tags="slow,develop,debug" -timeout 20m ./pkg/... ./internal/...
|
||||
run-test-mariadb:
|
||||
$(info Running all Go tests on MariaDB...)
|
||||
PHOTOPRISM_TEST_DRIVER="mysql" PHOTOPRISM_TEST_DSN="root:photoprism@tcp(mariadb:4001)/acceptance?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" $(GOTEST) -parallel 1 -count 1 -cpu 1 -tags="slow,develop" -timeout 20m ./pkg/... ./internal/...
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ func (c *Config) ReSync(token string) (err error) {
|
|||
|
||||
// Return if no endpoint URL is set.
|
||||
if endpointUrl == "" {
|
||||
log.Debugf("config: unable to obtain API key for maps and places (service disabled)")
|
||||
log.Debugf("config: unable to obtain key for maps and places (service disabled)")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -235,10 +235,10 @@ func (c *Config) ReSync(token string) (err error) {
|
|||
|
||||
if c.Key == "" {
|
||||
method = http.MethodPost
|
||||
log.Tracef("config: requesting new API key for maps and places")
|
||||
log.Tracef("config: requesting new key for maps and places")
|
||||
} else {
|
||||
method = http.MethodPut
|
||||
log.Tracef("config: requesting API key for maps and places")
|
||||
log.Tracef("config: requesting key for maps and places")
|
||||
}
|
||||
|
||||
// Create JSON request.
|
||||
|
|
@ -275,7 +275,7 @@ func (c *Config) ReSync(token string) (err error) {
|
|||
if err != nil {
|
||||
return err
|
||||
} else if r.StatusCode >= 400 {
|
||||
err = fmt.Errorf("requesting api key from %s failed (error %d)", GetServiceHost(), r.StatusCode)
|
||||
err = fmt.Errorf("failed to request key from %s (error %d)", GetServiceHost(), r.StatusCode)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ func TestConfig_Refresh(t *testing.T) {
|
|||
if sess, err := c.DecodeSession(false); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if sess.Expired() {
|
||||
t.Fatalf("session expired: %+v", sess)
|
||||
t.Fatalf("(1) session expired: %+v", sess)
|
||||
} else {
|
||||
t.Logf("(1) session: %#v", sess)
|
||||
}
|
||||
|
|
@ -114,9 +114,9 @@ func TestConfig_Refresh(t *testing.T) {
|
|||
if sess, err := c.DecodeSession(false); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if sess.Expired() {
|
||||
t.Fatal("session expired")
|
||||
t.Fatal("(2) session expired")
|
||||
} else {
|
||||
t.Logf("session: %#v", sess)
|
||||
t.Logf("(2) session: %#v", sess)
|
||||
}
|
||||
|
||||
if err := c.Save(); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue