From 40fa1099bf9770dd0535690c1b1ebf8aad60306b Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Wed, 13 Dec 2023 11:19:08 +0400 Subject: [PATCH 1/3] StatusViewTest: Fix tests. --- changelog.d/fix-tests.skip | 0 test/pleroma/web/mastodon_api/views/status_view_test.exs | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog.d/fix-tests.skip diff --git a/changelog.d/fix-tests.skip b/changelog.d/fix-tests.skip new file mode 100644 index 000000000..e69de29bb diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index b31955891..d82eeb7af 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -11,6 +11,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do alias Pleroma.HTML alias Pleroma.Object alias Pleroma.Repo + alias Pleroma.UnstubbedConfigMock, as: ConfigMock alias Pleroma.User alias Pleroma.UserRelationship alias Pleroma.Web.CommonAPI @@ -19,9 +20,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do require Bitwise + import Mox + import OpenApiSpex.TestAssertions import Pleroma.Factory import Tesla.Mock - import OpenApiSpex.TestAssertions setup do 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()) end + @tag capture_log: true test "returns a temporary ap_id based user for activities missing db users" do user = insert(:user) @@ -784,6 +787,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do clear_config([:media_proxy, :enabled], true) clear_config([:media_preview_proxy, :enabled]) + ConfigMock + |> stub_with(Pleroma.Test.StaticConfig) + page_url = "http://example.com" card = %{ From 935dce9a0b9ae4ff2d44033ec372f64b7fb6b5ce Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Wed, 13 Dec 2023 12:45:52 +0400 Subject: [PATCH 2/3] Gitlab CI: Update postgres for rum tests. --- .gitlab-ci.yml | 18 +----------------- ci/postgres_rum/Dockerfile | 3 +++ 2 files changed, 4 insertions(+), 17 deletions(-) create mode 100644 ci/postgres_rum/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b848d3c98..a204948ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -154,22 +154,6 @@ unit-testing-erratic: - mix ecto.migrate - 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: extends: - .build_changes_policy @@ -177,7 +161,7 @@ unit-testing-rum: stage: test cache: *testing_cache_policy services: - - name: minibikini/postgres-with-rum:12 + - name: lainsoykaf/postgres-with-rum:13 alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] variables: diff --git a/ci/postgres_rum/Dockerfile b/ci/postgres_rum/Dockerfile new file mode 100644 index 000000000..dc727df1d --- /dev/null +++ b/ci/postgres_rum/Dockerfile @@ -0,0 +1,3 @@ +FROM postgres:13-bullseye + +RUN apt-get update && apt-get install -y postgresql-13-rum/bullseye-pgdg From 1458de92f0eb2e743c359a86a27db83b117595e9 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Wed, 13 Dec 2023 13:08:00 +0400 Subject: [PATCH 3/3] Gitlab CI: Switch to our own docker hub --- .gitlab-ci.yml | 2 +- ci/postgres_rum/build_and_push.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100755 ci/postgres_rum/build_and_push.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a204948ce..eb31a8086 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -161,7 +161,7 @@ unit-testing-rum: stage: test cache: *testing_cache_policy services: - - name: lainsoykaf/postgres-with-rum:13 + - name: git.pleroma.social:5050/pleroma/pleroma/postgres-with-rum-13 alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] variables: diff --git a/ci/postgres_rum/build_and_push.sh b/ci/postgres_rum/build_and_push.sh new file mode 100755 index 000000000..c437b64a7 --- /dev/null +++ b/ci/postgres_rum/build_and_push.sh @@ -0,0 +1 @@ +docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/postgres-with-rum-13:latest --push .