Merge branch 'fix-develop-tests' into 'develop'

StatusViewTest: Fix tests.

See merge request pleroma/pleroma!3998
This commit is contained in:
lain 2023-12-13 10:05:18 +00:00
commit 02acf7c0b3
5 changed files with 12 additions and 18 deletions

View File

@ -154,22 +154,6 @@ unit-testing-erratic:
- mix ecto.migrate - mix ecto.migrate
- mix test --only=erratic - mix test --only=erratic
# Removed to fix CI issue. In this early state it wasn't adding much value anyway.
# TODO Fix and reinstate federated testing
# federated-testing:
# stage: test
# cache: *testing_cache_policy
# services:
# - name: minibikini/postgres-with-rum:12
# alias: postgres
# command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
# script:
# - mix deps.get
# - mix ecto.create
# - mix ecto.migrate
# - epmd -daemon
# - mix test --trace --only federated
unit-testing-rum: unit-testing-rum:
extends: extends:
- .build_changes_policy - .build_changes_policy
@ -177,7 +161,7 @@ unit-testing-rum:
stage: test stage: test
cache: *testing_cache_policy cache: *testing_cache_policy
services: services:
- name: minibikini/postgres-with-rum:12 - name: git.pleroma.social:5050/pleroma/pleroma/postgres-with-rum-13
alias: postgres alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
variables: variables:

View File

View File

@ -0,0 +1,3 @@
FROM postgres:13-bullseye
RUN apt-get update && apt-get install -y postgresql-13-rum/bullseye-pgdg

View File

@ -0,0 +1 @@
docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/postgres-with-rum-13:latest --push .

View File

@ -11,6 +11,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
alias Pleroma.HTML alias Pleroma.HTML
alias Pleroma.Object alias Pleroma.Object
alias Pleroma.Repo alias Pleroma.Repo
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
alias Pleroma.User alias Pleroma.User
alias Pleroma.UserRelationship alias Pleroma.UserRelationship
alias Pleroma.Web.CommonAPI alias Pleroma.Web.CommonAPI
@ -19,9 +20,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
require Bitwise require Bitwise
import Mox
import OpenApiSpex.TestAssertions
import Pleroma.Factory import Pleroma.Factory
import Tesla.Mock import Tesla.Mock
import OpenApiSpex.TestAssertions
setup do setup do
mock(fn env -> apply(HttpRequestMock, :request, [env]) end) mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
@ -198,6 +200,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec()) assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec())
end end
@tag capture_log: true
test "returns a temporary ap_id based user for activities missing db users" do test "returns a temporary ap_id based user for activities missing db users" do
user = insert(:user) user = insert(:user)
@ -784,6 +787,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
clear_config([:media_proxy, :enabled], true) clear_config([:media_proxy, :enabled], true)
clear_config([:media_preview_proxy, :enabled]) clear_config([:media_preview_proxy, :enabled])
ConfigMock
|> stub_with(Pleroma.Test.StaticConfig)
page_url = "http://example.com" page_url = "http://example.com"
card = %{ card = %{