@@ -477,3 +477,63 @@ listening_addr = "0.0.0.0:{WEBHOOK_INTERNAL_PORT}"
477477
478478 toml_string
479479}
480+
481+ #[ cfg( test) ]
482+ mod tests {
483+ use insta:: assert_snapshot;
484+
485+ use crate :: {
486+ generated:: obelisk_flyio:: workflow:: types:: {
487+ ActivityWasm , ObeliskConfig , Route , WebhookEndpoint , Workflow ,
488+ } ,
489+ serialize_obelisk_toml,
490+ } ;
491+
492+ #[ test]
493+ fn serialize_obelisk_toml_should_produce_correct_config ( ) {
494+ let config = ObeliskConfig {
495+ activity_wasm_list : Some ( vec ! [
496+ ActivityWasm {
497+ name: "stargazers_activity_llm_chatgpt" . to_string( ) ,
498+ location_oci: "docker.io/getobelisk/demo_stargazers_activity_llm_openai:2025-09-28@sha256:4b10a66c80bec625a6b0a2e8a4b5192f8a2356eca19c0a6705335771a8b8b1e8" . to_string( ) ,
499+ env_vars: Some ( vec![ "OPENAI_API_KEY" . to_string( ) ] ) ,
500+ lock_expiry_seconds: Some ( 10 ) ,
501+ } ,
502+ ActivityWasm {
503+ name: "stargazers_activity_github_impl" . to_string( ) ,
504+ location_oci: "docker.io/getobelisk/demo_stargazers_activity_github_impl:2025-09-28@sha256:8f6fc9b1379b359e085998fa2fd7c966c450327d09770807dfba4b2f75731d72" . to_string( ) ,
505+ env_vars: Some ( vec![ "GITHUB_TOKEN" . to_string( ) ] ) ,
506+ lock_expiry_seconds: Some ( 5 ) ,
507+ } ,
508+ ActivityWasm {
509+ name: "stargazers_activity_db_turso" . to_string( ) ,
510+ location_oci: "docker.io/getobelisk/demo_stargazers_activity_db_turso:2025-09-28@sha256:26b08b3d0c6e430944d8187a00bd9817a83ab89e11ba72d15e7533a758addf33" . to_string( ) ,
511+ env_vars: Some ( vec![ "TURSO_TOKEN" . to_string( ) , "TURSO_LOCATION" . to_string( ) ] ) ,
512+ lock_expiry_seconds: Some ( 5 ) ,
513+ } ,
514+ ] ) ,
515+ workflow_list : Some ( vec ! [
516+ Workflow {
517+ name: "stargazers_workflow" . to_string( ) ,
518+ location_oci: "docker.io/getobelisk/demo_stargazers_workflow:2025-09-28@sha256:678d85e3e2f89d22794fd1ffc0217bf23510e1349ee150a54d5c82cc2ef75834" . to_string( ) ,
519+ } ,
520+ ] ) ,
521+ webhook_endpoint_list : Some ( vec ! [
522+ WebhookEndpoint {
523+ name: "stargazers_webhook" . to_string( ) ,
524+ location_oci: "docker.io/getobelisk/demo_stargazers_webhook:2025-09-28@sha256:aa4dfa18d1ad7c1623163eeabb41a415ebad5296fca8f3b957987afcdb2a0f40" . to_string( ) ,
525+ routes: vec![
526+ Route {
527+ methods: vec![ "POST" . to_string( ) , "GET" . to_string( ) ] ,
528+ path: "" . to_string( ) ,
529+ } ,
530+ ] ,
531+ env_vars: Some ( vec![ "GITHUB_WEBHOOK_SECRET" . to_string( ) ] ) ,
532+ } ,
533+ ] ) ,
534+ } ;
535+
536+ let toml = serialize_obelisk_toml ( & config) ;
537+ assert_snapshot ! ( toml) ;
538+ }
539+ }
0 commit comments