Skip to content

Commit

Permalink
Merge branch 'main' into N21-2314-provisioning-decoupling
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap authored Jan 31, 2025
2 parents 3b399d2 + f8f3e1e commit 2c2bbc1
Show file tree
Hide file tree
Showing 146 changed files with 6,788 additions and 3,195 deletions.
2 changes: 2 additions & 0 deletions ansible/roles/common-cartridge/templates/deployment.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: common-cartridge
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
volumes:
- name: libraries-list
configMap:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ spec:
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }}
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }}
spec:
os:
name: linux
containers:
- name: vidis-sync-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ spec:
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }}
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }}
spec:
os:
name: linux
containers:
- name: media-metadata-sync-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
spec:
template:
spec:
os:
name: linux
containers:
- name: moin-schule-users-deletion-queueing-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
spec:
template:
spec:
os:
name: linux
containers:
- name: moin-schule-users-sync-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-admin
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: amqp-files
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-files
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-fwu
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: board-collaboration
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: data-deletion-trigger-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-migration-job
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: preview-generator
image: {{ SCHULCLOUD_SERVER_IMAGE }}:file-preview-{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-h5p
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ metadata:
spec:
template:
spec:
os:
name: linux
containers:
- name: api-init
image: quay.io/schulcloudverbund/infra-tools:latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ spec:
activeDeadlineSeconds: {{ SERVER_LDAP_SYNC_FULL_CRONJOB_TIMEOUT|default("39600", true) }}
template:
spec:
os:
name: linux
containers:
- name: api-ldapsync-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-worker
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-migration-systems
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
spec:
template:
spec:
os:
name: linux
containers:
- name: api-tsp-sync-base-cronjob
image: quay.io/schulcloudverbund/infra-tools:latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-tsp-sync-cronjob
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-tsp-sync
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ spec:
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
os:
name: linux
containers:
- name: api-tsp-sync-init
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
spec:
template:
spec:
os:
name: linux
containers:
- name: api-tsp-sync-school-cronjob
image: quay.io/schulcloudverbund/infra-tools:latest
Expand Down
107 changes: 107 additions & 0 deletions apps/server/src/infra/boards-client/boards-client.adapter.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { Test, TestingModule } from '@nestjs/testing';
import { createMock } from '@golevelup/ts-jest';
import { faker } from '@faker-js/faker';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import { BoardsClientAdapter } from './boards-client.adapter';
import { BoardApi, BoardResponse, CreateBoardBodyParams, CreateBoardResponse } from './generated';

describe(BoardsClientAdapter.name, () => {
let module: TestingModule;
let sut: BoardsClientAdapter;

const boardApiMock = createMock<BoardApi>();

beforeAll(async () => {
module = await Test.createTestingModule({
providers: [
BoardsClientAdapter,
{
provide: BoardApi,
useValue: boardApiMock,
},
],
}).compile();
sut = module.get(BoardsClientAdapter);
});

afterAll(async () => {
await module.close();
});

beforeEach(() => {
jest.clearAllMocks();
});

it('should be defined', () => {
expect(sut).toBeDefined();
});

describe('createBoard', () => {
describe('when creating a board', () => {
const setup = () => {
const params: CreateBoardBodyParams = {
title: faker.lorem.words(),
layout: 'columns',
parentId: faker.string.uuid(),
parentType: 'course',
};
const responseData: CreateBoardResponse = {
id: faker.string.uuid(),
};

boardApiMock.boardControllerCreateBoard.mockResolvedValue(axiosResponseFactory.build({ data: responseData }));

return {
params,
responseData,
};
};

it('should call boardApi.boardControllerCreateBoard', async () => {
const { params, responseData } = setup();

const response = await sut.createBoard(params);

expect(response).toEqual(responseData);
expect(boardApiMock.boardControllerCreateBoard).toHaveBeenCalledWith(params);
});
});
});

describe('getBoardSkeletonById', () => {
describe('when reading a board', () => {
const setup = () => {
const boardId = faker.string.uuid();
const responseData: BoardResponse = {
id: boardId,
title: faker.lorem.words(),
layout: 'columns',
columns: [],
isVisible: true,
timestamps: {
createdAt: faker.date.recent().toISOString(),
lastUpdatedAt: faker.date.recent().toISOString(),
},
};

boardApiMock.boardControllerGetBoardSkeleton.mockResolvedValue(
axiosResponseFactory.build({ data: responseData })
);

return {
boardId,
responseData,
};
};

it('should call boardApi.boardControllerGetBoardSkeleton', async () => {
const { boardId, responseData } = setup();

const response = await sut.getBoardSkeletonById(boardId);

expect(response).toEqual(responseData);
expect(boardApiMock.boardControllerGetBoardSkeleton).toHaveBeenCalledWith(boardId);
});
});
});
});
19 changes: 19 additions & 0 deletions apps/server/src/infra/boards-client/boards-client.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Injectable } from '@nestjs/common';
import { BoardApi, BoardResponse, CreateBoardBodyParams, CreateBoardResponse } from './generated';

@Injectable()
export class BoardsClientAdapter {
constructor(private readonly boardApi: BoardApi) {}

public async createBoard(params: CreateBoardBodyParams): Promise<CreateBoardResponse> {
const response = await this.boardApi.boardControllerCreateBoard(params);

return response.data;
}

public async getBoardSkeletonById(boardId: string): Promise<BoardResponse> {
const response = await this.boardApi.boardControllerGetBoardSkeleton(boardId);

return response.data;
}
}
3 changes: 3 additions & 0 deletions apps/server/src/infra/boards-client/boards-client.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface BoardsClientConfig {
API_HOST: string;
}
Loading

0 comments on commit 2c2bbc1

Please sign in to comment.