disable gravatar in test (#32529)
When running e2e tests on flaky networks, gravatar can cause a timeout and test failures. Turn off, and populate avatars on e2e test suite run to make them reliable. (cherry picked from commit 9ac74a1a408136455a9e0586fb8e65163048597b) Conflicts: models/fixtures/user.yml services/repository/contributors_graph_test.go trivial context conflicts
This commit is contained in:
parent
32a91add34
commit
eb0645f185
5 changed files with 99 additions and 98 deletions
|
@ -5,6 +5,7 @@ package integration
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
@ -42,7 +43,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:title": "User Thirty",
|
||||
"og:url": setting.AppURL + "user30",
|
||||
"og:type": "profile",
|
||||
"og:image": "https://secure.gravatar.com/avatar/eae1f44b34ff27284cb0792c7601c89c?d=identicon",
|
||||
"og:image": "http://localhost:3003/assets/img/avatar_default.png",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -54,7 +55,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:url": setting.AppURL + "the_34-user.with.all.allowedChars",
|
||||
"og:description": "some [commonmark](https://commonmark.org/)!",
|
||||
"og:type": "profile",
|
||||
"og:image": setting.AppURL + "avatars/avatar34",
|
||||
"og:image": "http://localhost:3003/assets/img/avatar_default.png",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -66,7 +67,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:url": setting.AppURL + "user2/repo1/issues/1",
|
||||
"og:description": "content for the first issue",
|
||||
"og:type": "object",
|
||||
"og:image": "https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon",
|
||||
"og:image": "http://localhost:3003/avatars/ab53a2911ddf9b4817ac01ddcd3d975f",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -78,7 +79,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:url": setting.AppURL + "user2/repo1/pulls/2",
|
||||
"og:description": "content for the second issue",
|
||||
"og:type": "object",
|
||||
"og:image": "https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon",
|
||||
"og:image": "http://localhost:3003/avatars/ab53a2911ddf9b4817ac01ddcd3d975f",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -89,7 +90,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:title": "repo49/test/test.txt at master",
|
||||
"og:url": setting.AppURL + "/user27/repo49/src/branch/master/test/test.txt",
|
||||
"og:type": "object",
|
||||
"og:image": "https://secure.gravatar.com/avatar/7095710e927665f1bdd1ced94152f232?d=identicon",
|
||||
"og:image": "http://localhost:3003/assets/img/avatar_default.png",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -100,7 +101,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:title": "Page With Spaced Name",
|
||||
"og:url": setting.AppURL + "/user2/repo1/wiki/Page-With-Spaced-Name",
|
||||
"og:type": "object",
|
||||
"og:image": "https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon",
|
||||
"og:image": "http://localhost:3003/avatars/ab53a2911ddf9b4817ac01ddcd3d975f",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -111,7 +112,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:title": "repo1",
|
||||
"og:url": setting.AppURL + "user2/repo1",
|
||||
"og:type": "object",
|
||||
"og:image": "https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon",
|
||||
"og:image": "http://localhost:3003/avatars/ab53a2911ddf9b4817ac01ddcd3d975f",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -123,7 +124,7 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
"og:url": setting.AppURL + "user27/repo49",
|
||||
"og:description": "A wonderful repository with more than just a README.md",
|
||||
"og:type": "object",
|
||||
"og:image": "https://secure.gravatar.com/avatar/7095710e927665f1bdd1ced94152f232?d=identicon",
|
||||
"og:image": "http://localhost:3003/assets/img/avatar_default.png",
|
||||
"og:site_name": siteName,
|
||||
},
|
||||
},
|
||||
|
@ -141,6 +142,10 @@ func TestOpenGraphProperties(t *testing.T) {
|
|||
assert.True(t, foundProp)
|
||||
content, foundContent := selection.Attr("content")
|
||||
assert.True(t, foundContent, "opengraph meta tag without a content property")
|
||||
if prop == "og:image" {
|
||||
content = strings.ReplaceAll(content, "http://localhost:3001", "http://localhost:3003")
|
||||
content = strings.ReplaceAll(content, "http://localhost:3002", "http://localhost:3003")
|
||||
}
|
||||
foundProps[prop] = content
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue