Skip to content

Tests for unikernel endpoints - #291

Merged
hannesm merged 3 commits into
mainfrom
unikernel_endpoints
Sep 22, 2026
Merged

hannesm merged 3 commits into
mainfrom
unikernel_endpoints

Conversation

@PizieDust

Copy link
Copy Markdown
Collaborator

This PR adds tests for unikernel endpoints.

GET /api/unikernels
POST /api/unikernel/create
POST /api/unikernel/destroy
POST /api/unikernel/restart

Base automatically changed from mock_albatross to main September 22, 2026 12:50
@hannesm

hannesm commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

I squash-merged #286, this now needs to be rebased..

Comment thread tests/utils/test_utils.ml
Comment on lines +523 to 555
let auth_hdr =
match token with
| Some t -> Fmt.str "Authorization: Bearer %s\r\n" t
| None -> ""
in
let cookie_hdr =
match (session_cookie, csrf_token) with
| "", "" -> ""
| s, "" -> Fmt.str "Cookie: molly_session=%s\r\n" s
| "", c -> Fmt.str "Cookie: molly_csrf=%s\r\n" c
| s, c -> Fmt.str "Cookie: molly_session=%s; molly_csrf=%s\r\n" s c
in
Fmt.str
"GET %s HTTP/1.1\r\n\
Host: localhost\r\n\
User-Agent: Alcotest-client\r\n\
%s%s\r\n"
path auth_hdr cookie_hdr

let make_post_request ~path ~body ?(csrf_token = "") ?(session_cookie = "")
?token () =
let auth_hdr =
match token with
| Some t -> Fmt.str "Authorization: Bearer %s\r\n" t
| None -> ""
in
let cookie_hdr =
match (session_cookie, csrf_token) with
| "", "" -> ""
| s, "" -> Fmt.str "Cookie: molly_session=%s\r\n" s
| "", c -> Fmt.str "Cookie: molly_csrf=%s\r\n" c
| s, c -> Fmt.str "Cookie: molly_session=%s; molly_csrf=%s\r\n" s c
in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's room for refactoring here...

@hannesm

hannesm commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

thanks

@hannesm
hannesm merged commit ddd2f1a into main Sep 22, 2026
1 check passed
@hannesm
hannesm deleted the unikernel_endpoints branch September 22, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants