Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [CLOUD] Instant deployment (#201688) #201978

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,60 @@ describe('PUT /internal/spaces/space/{id}/solution', () => {
});
});

it('should update the solution_type when it is search', async () => {
const payload = {
solution_type: 'search',
};

const { routeHandler, savedObjectsRepositoryMock } = await setup();

const request = httpServerMock.createKibanaRequest({
params: {
id: 'a-space',
},
body: payload,
method: 'post',
});

const response = await routeHandler(mockRouteContext, request, kibanaResponseFactory);

const { status } = response;

expect(status).toEqual(200);
expect(savedObjectsRepositoryMock.update).toHaveBeenCalledTimes(1);
expect(savedObjectsRepositoryMock.update).toHaveBeenCalledWith('space', 'a-space', {
solution: 'es',
name: 'a space',
color: undefined,
description: undefined,
disabledFeatures: [],
imageUrl: undefined,
initials: undefined,
});
});

it('should failed when the solution_type is not the expected one', async () => {
const payload = {
solution_type: 'searchXoXo',
};

const { routeHandler } = await setup();

const request = httpServerMock.createKibanaRequest({
params: {
id: 'a-space',
},
body: payload,
method: 'post',
});

const response = await routeHandler(mockRouteContext, request, kibanaResponseFactory);

const { status } = response;

expect(status).toEqual(500);
});

it('should not allow a new space to be created', async () => {
const payload = {
solution: 'oblt',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const spaceSolutionSchema = schema.oneOf([
schema.literal('security'),
schema.literal('observability'),
schema.literal('elasticsearch'),
schema.literal('search'),
]),
}),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function ({ getService }: FtrProviderContext) {
.expect(400);

expect(body.message).to.eql(
'[request body]: types that failed validation:\n- [request body.0.solution]: expected at least one defined value but got [undefined]\n- [request body.1.solution_type]: types that failed validation:\n - [request body.solution_type.0]: expected value to equal [security]\n - [request body.solution_type.1]: expected value to equal [observability]\n - [request body.solution_type.2]: expected value to equal [elasticsearch]'
'[request body]: types that failed validation:\n- [request body.0.solution]: expected at least one defined value but got [undefined]\n- [request body.1.solution_type]: types that failed validation:\n - [request body.solution_type.0]: expected value to equal [security]\n - [request body.solution_type.1]: expected value to equal [observability]\n - [request body.solution_type.2]: expected value to equal [elasticsearch]\n - [request body.solution_type.3]: expected value to equal [search]'
);
});

Expand Down