mirror of https://github.com/jlelse/GoBlog
Fix and reenable automatic tests
This commit is contained in:
parent
208ac792cd
commit
0acfbd393b
|
@ -23,12 +23,12 @@ jobs:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# - name: Test
|
- name: Test
|
||||||
# uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
# with:
|
with:
|
||||||
# push: false
|
push: false
|
||||||
# target: test
|
target: test
|
||||||
# tags: test
|
tags: test
|
||||||
- name: Build base image
|
- name: Build base image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -49,6 +49,9 @@ func Test_webfinger(t *testing.T) {
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
app.cfg.Server.PublicAddress = "https://example.com"
|
app.cfg.Server.PublicAddress = "https://example.com"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
func (a *goBlog) cleanup() {
|
||||||
|
if a.db != nil {
|
||||||
|
_ = a.db.close()
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,8 @@ func Test_authMiddleware(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ func Test_blogroll(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ func Test_blogStats(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.DefaultBlog = "en"
|
app.cfg.DefaultBlog = "en"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ func Test_captchaMiddleware(t *testing.T) {
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ func Test_comments(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.DefaultBlog = "en"
|
app.cfg.DefaultBlog = "en"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
err := app.initConfig(false)
|
err := app.initConfig(false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
|
@ -43,6 +43,8 @@ func Test_contact(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.DefaultBlog = "en"
|
app.cfg.DefaultBlog = "en"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ func Test_editorPreview(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ func Test_errors(t *testing.T) {
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ func Test_feeds(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ func Test_geoTrack(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ func Test_geo(t *testing.T) {
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ func Test_indexNow(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.IndexNow = &configIndexNow{Enabled: true}
|
app.cfg.IndexNow = &configIndexNow{Enabled: true}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ func Test_indieAuthServer(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.Cache.Enable = false
|
app.cfg.Cache.Enable = false
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ func Test_checkIndieAuth(t *testing.T) {
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ func Test_micropubQuery(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ func Test_ntfySending(t *testing.T) {
|
||||||
httpClient: fakeClient.Client,
|
httpClient: fakeClient.Client,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ func Test_postsDb(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -380,6 +383,9 @@ func Test_postDeletesParams(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ func Test_checkDeletedPosts(t *testing.T) {
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ func Test_postsScheduler(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ func Test_serveDate(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -104,6 +107,9 @@ func Test_servePost(t *testing.T) {
|
||||||
Username: "test",
|
Username: "test",
|
||||||
Password: "test",
|
Password: "test",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ func Test_privateMode(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ func Test_reactionsLowLevel(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -95,6 +98,9 @@ func Test_reactionsHighLevel(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ func Test_sitemap(t *testing.T) {
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
10
ui_test.go
10
ui_test.go
|
@ -20,6 +20,9 @@ func Test_renderPostTax(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -46,6 +49,9 @@ func Test_renderOldContentWarning(t *testing.T) {
|
||||||
app := &goBlog{
|
app := &goBlog{
|
||||||
cfg: createDefaultTestConfig(t),
|
cfg: createDefaultTestConfig(t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -73,6 +79,8 @@ func Test_renderInteractions(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.Server.PublicAddress = "https://example.com"
|
app.cfg.Server.PublicAddress = "https://example.com"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -142,6 +150,8 @@ func Test_renderAuthor(t *testing.T) {
|
||||||
app.cfg.User.Picture = "https://example.com/picture.jpg"
|
app.cfg.User.Picture = "https://example.com/picture.jpg"
|
||||||
app.cfg.User.Name = "John Doe"
|
app.cfg.User.Name = "John Doe"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ func Test_verifyMention(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.Server.PublicAddress = "https://example.org"
|
app.cfg.Server.PublicAddress = "https://example.org"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -70,6 +72,8 @@ func Test_verifyMentionBidgy(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.Server.PublicAddress = "https://example.org"
|
app.cfg.Server.PublicAddress = "https://example.org"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
@ -107,6 +111,8 @@ func Test_verifyMentionColin(t *testing.T) {
|
||||||
}
|
}
|
||||||
app.cfg.Server.PublicAddress = "https://jlelse.blog"
|
app.cfg.Server.PublicAddress = "https://jlelse.blog"
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ func Test_webmentions(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Cleanup(app.cleanup)
|
||||||
|
|
||||||
_ = app.initConfig(false)
|
_ = app.initConfig(false)
|
||||||
app.initComponents(false)
|
app.initComponents(false)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue