Fixing tests.

This commit is contained in:
Dessalines 2020-09-15 10:21:40 -05:00
parent 91de139c73
commit 29656b5e97
8 changed files with 69 additions and 46 deletions

View file

@ -235,7 +235,7 @@ test('Reply to a comment', async () => {
test('Mention beta', async () => { test('Mention beta', async () => {
// Create a mention on alpha // Create a mention on alpha
let mentionContent = 'A test mention of @lemmy_beta@lemmy-beta:8550'; let mentionContent = 'A test mention of @lemmy_beta@lemmy-beta:8551';
let commentRes = await createComment(alpha, postRes.post.id); let commentRes = await createComment(alpha, postRes.post.id);
await delay(); await delay();
let mentionRes = await createComment( let mentionRes = await createComment(
@ -275,7 +275,7 @@ test('A and G subscribe to B (center) A posts, G mentions B, it gets announced t
let gammaPost = search.posts[0]; let gammaPost = search.posts[0];
let commentContent = let commentContent =
'A jest test federated comment announce, lets mention @lemmy_beta@lemmy-beta:8550'; 'A jest test federated comment announce, lets mention @lemmy_beta@lemmy-beta:8551';
let commentRes = await createComment( let commentRes = await createComment(
gamma, gamma,
gammaPost.id, gammaPost.id,

View file

@ -26,7 +26,7 @@ test('Create community', async () => {
await delay(); await delay();
// Cache the community on beta, make sure it has the other fields // Cache the community on beta, make sure it has the other fields
let searchShort = `!${prevName}@lemmy-alpha:8540`; let searchShort = `!${prevName}@lemmy-alpha:8541`;
let search = await searchForCommunity(beta, searchShort); let search = await searchForCommunity(beta, searchShort);
let communityOnBeta = search.communities[0]; let communityOnBeta = search.communities[0];
expect(communityOnBeta.name).toBe(communityRes.community.name); expect(communityOnBeta.name).toBe(communityRes.community.name);

View file

@ -1,3 +1,4 @@
jest.setTimeout(120000);
import { import {
alpha, alpha,
setupLogins, setupLogins,

View file

@ -50,23 +50,23 @@ export interface API {
} }
export let alpha: API = { export let alpha: API = {
client: new LemmyHttp('http://localhost:8540/api/v1'), client: new LemmyHttp('http://localhost:8541/api/v1'),
}; };
export let beta: API = { export let beta: API = {
client: new LemmyHttp('http://localhost:8550/api/v1'), client: new LemmyHttp('http://localhost:8551/api/v1'),
}; };
export let gamma: API = { export let gamma: API = {
client: new LemmyHttp('http://localhost:8560/api/v1'), client: new LemmyHttp('http://localhost:8561/api/v1'),
}; };
export let delta: API = { export let delta: API = {
client: new LemmyHttp('http://localhost:8570/api/v1'), client: new LemmyHttp('http://localhost:8571/api/v1'),
}; };
export let epsilon: API = { export let epsilon: API = {
client: new LemmyHttp('http://localhost:8580/api/v1'), client: new LemmyHttp('http://localhost:8581/api/v1'),
}; };
export async function setupLogins() { export async function setupLogins() {
@ -236,7 +236,7 @@ export async function searchForBetaCommunity(
// Make sure lemmy-beta/c/main is cached on lemmy_alpha // Make sure lemmy-beta/c/main is cached on lemmy_alpha
// Use short-hand search url // Use short-hand search url
let form: SearchForm = { let form: SearchForm = {
q: '!main@lemmy-beta:8550', q: '!main@lemmy-beta:8551',
type_: SearchType.Communities, type_: SearchType.Communities,
sort: SortType.TopAll, sort: SortType.TopAll,
}; };

View file

@ -18,7 +18,7 @@ test('Create user', async () => {
let site = await getSite(alpha, auth); let site = await getSite(alpha, auth);
expect(site.my_user).toBeDefined(); expect(site.my_user).toBeDefined();
apShortname = `@${site.my_user.name}@lemmy-alpha:8540`; apShortname = `@${site.my_user.name}@lemmy-alpha:8541`;
}); });
test('Save user settings, check changed bio from beta', async () => { test('Save user settings, check changed bio from beta', async () => {

View file

@ -15,11 +15,11 @@ services:
depends_on: depends_on:
- pictrs - pictrs
- iframely - iframely
- lemmy-alpha-ui - lemmy-alpha
- lemmy-beta-ui - lemmy-beta
- lemmy-gamma-ui - lemmy-gamma
- lemmy-delta-ui - lemmy-delta
- lemmy-epsilon-ui - lemmy-epsilon
pictrs: pictrs:
restart: always restart: always
@ -56,6 +56,8 @@ services:
- RUST_LOG=debug - RUST_LOG=debug
depends_on: depends_on:
- postgres_alpha - postgres_alpha
ports:
- "8541:8541"
postgres_alpha: postgres_alpha:
image: postgres:12-alpine image: postgres:12-alpine
environment: environment:
@ -93,6 +95,8 @@ services:
- RUST_LOG=debug - RUST_LOG=debug
depends_on: depends_on:
- postgres_beta - postgres_beta
ports:
- "8551:8551"
postgres_beta: postgres_beta:
image: postgres:12-alpine image: postgres:12-alpine
environment: environment:
@ -130,6 +134,8 @@ services:
- RUST_LOG=debug - RUST_LOG=debug
depends_on: depends_on:
- postgres_gamma - postgres_gamma
ports:
- "8561:8561"
postgres_gamma: postgres_gamma:
image: postgres:12-alpine image: postgres:12-alpine
environment: environment:
@ -168,6 +174,8 @@ services:
- RUST_LOG=debug - RUST_LOG=debug
depends_on: depends_on:
- postgres_delta - postgres_delta
ports:
- "8571:8571"
postgres_delta: postgres_delta:
image: postgres:12-alpine image: postgres:12-alpine
environment: environment:
@ -206,6 +214,8 @@ services:
- RUST_LOG=debug - RUST_LOG=debug
depends_on: depends_on:
- postgres_epsilon - postgres_epsilon
ports:
- "8581:8581"
postgres_epsilon: postgres_epsilon:
image: postgres:12-alpine image: postgres:12-alpine
environment: environment:

View file

@ -11,8 +11,14 @@ http {
# Upload limit for pictshare # Upload limit for pictshare
client_max_body_size 50M; client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-alpha:8541/api/v1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / { location / {
proxy_pass http://lemmy-alpha-ui:1234/; proxy_pass http://lemmy-alpha-ui:1234;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -20,12 +26,6 @@ http {
# Cuts off the trailing slash on URLs to make them valid # Cuts off the trailing slash on URLs to make them valid
rewrite ^(.+)/+$ $1 permanent; rewrite ^(.+)/+$ $1 permanent;
} }
location /api/v1/ws {
proxy_pass http://lemmy-alpha:8541;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /iframely/ { location /iframely/ {
proxy_pass http://iframely:80/; proxy_pass http://iframely:80/;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -42,6 +42,12 @@ http {
# Upload limit for pictshare # Upload limit for pictshare
client_max_body_size 50M; client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-beta:8551/api/v1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / { location / {
proxy_pass http://lemmy-beta-ui:1234; proxy_pass http://lemmy-beta-ui:1234;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -51,12 +57,6 @@ http {
# Cuts off the trailing slash on URLs to make them valid # Cuts off the trailing slash on URLs to make them valid
rewrite ^(.+)/+$ $1 permanent; rewrite ^(.+)/+$ $1 permanent;
} }
location /api/v1/ws {
proxy_pass http://lemmy-beta:8551;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /iframely/ { location /iframely/ {
proxy_pass http://iframely:80/; proxy_pass http://iframely:80/;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -73,6 +73,12 @@ http {
# Upload limit for pictshare # Upload limit for pictshare
client_max_body_size 50M; client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-gamma:8561/api/v1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / { location / {
proxy_pass http://lemmy-gamma-ui:1234; proxy_pass http://lemmy-gamma-ui:1234;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -82,12 +88,6 @@ http {
# Cuts off the trailing slash on URLs to make them valid # Cuts off the trailing slash on URLs to make them valid
rewrite ^(.+)/+$ $1 permanent; rewrite ^(.+)/+$ $1 permanent;
} }
location /api/v1/ws {
proxy_pass http://lemmy-gamma:8561;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /iframely/ { location /iframely/ {
proxy_pass http://iframely:80/; proxy_pass http://iframely:80/;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -104,6 +104,12 @@ http {
# Upload limit for pictshare # Upload limit for pictshare
client_max_body_size 50M; client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-delta:8571/api/v1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / { location / {
proxy_pass http://lemmy-delta-ui:1234; proxy_pass http://lemmy-delta-ui:1234;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -113,12 +119,6 @@ http {
# Cuts off the trailing slash on URLs to make them valid # Cuts off the trailing slash on URLs to make them valid
rewrite ^(.+)/+$ $1 permanent; rewrite ^(.+)/+$ $1 permanent;
} }
location /api/v1/ws {
proxy_pass http://lemmy-delta:8571;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /iframely/ { location /iframely/ {
proxy_pass http://iframely:80/; proxy_pass http://iframely:80/;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -135,6 +135,12 @@ http {
# Upload limit for pictshare # Upload limit for pictshare
client_max_body_size 50M; client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-epsilon:8581/api/v1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / { location / {
proxy_pass http://lemmy-epsilon-ui:1234; proxy_pass http://lemmy-epsilon-ui:1234;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@ -144,12 +150,6 @@ http {
# Cuts off the trailing slash on URLs to make them valid # Cuts off the trailing slash on URLs to make them valid
rewrite ^(.+)/+$ $1 permanent; rewrite ^(.+)/+$ $1 permanent;
} }
location /api/v1/ws {
proxy_pass http://lemmy-epsilon:8581;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /iframely/ { location /iframely/ {
proxy_pass http://iframely:80/; proxy_pass http://iframely:80/;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;

View file

@ -94,6 +94,18 @@ impl ToApub for Community {
group.set_content(d); group.set_content(d);
} }
if let Some(icon) = &self.icon {
let mut image = Image::new();
image.set_url(icon.to_owned());
group.set_icon(image.into_any_base()?);
}
if let Some(banner_url) = &self.banner {
let mut image = Image::new();
image.set_url(banner_url.to_owned());
group.set_image(image.into_any_base()?);
}
let mut ap_actor = ApActor::new(self.get_inbox_url()?, group); let mut ap_actor = ApActor::new(self.get_inbox_url()?, group);
ap_actor ap_actor
.set_preferred_username(self.title.to_owned()) .set_preferred_username(self.title.to_owned())