Skip to content

Commit

Permalink
Start adding security to deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
afsalthaj committed Dec 4, 2024
1 parent e3cd015 commit a6b6cfa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 1 addition & 2 deletions golem-cli/tests/api_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ use golem_cli::model::{ApiDefinitionFileFormat, ApiSecurityScheme};
use golem_client::model::{
GatewayBindingData, GatewayBindingType, GatewayBindingWithTypeInfo, HttpApiDefinitionRequest,
HttpApiDefinitionResponseData, MethodPattern, RibInputTypeInfo, RibOutputTypeInfo,
RouteRequestData, RouteWithTypeInfo, SecuritySchemeData, VersionedComponentId,
RouteRequestData, RouteWithTypeInfo, VersionedComponentId,
};
use golem_test_framework::config::{EnvBasedTestDependencies, TestDependencies};
use golem_wasm_ast::analysis::analysed_type::{record, str, u64};
use golem_wasm_ast::analysis::NameTypePair;
use itertools::Itertools;
use serde::Serialize;
use serde_json::json;
use std::collections::HashMap;
Expand Down
11 changes: 6 additions & 5 deletions golem-cli/tests/api_deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ pub fn make_definition(
deps: &EnvBasedTestDependencies,
cli: &CliLive,
component_name: &str,
security: Option<&str>,
) -> Result<HttpApiDefinitionResponseData, anyhow::Error> {
let component = make_shopping_cart_component(deps, component_name, cli)?;
let component_id = component.component_urn.id.0.to_string();
let def = native_api_definition_request(component_name, &component_id, None);
let def = native_api_definition_request(component_name, &component_id, security);
let path = make_json_file(&def.id, &def)?;

cli.run(&["api-definition", "add", path.to_str().unwrap()])
Expand All @@ -90,7 +91,7 @@ pub fn make_definition(
fn api_deployment_deploy(
(deps, name, cli): (&EnvBasedTestDependencies, String, CliLive),
) -> Result<(), anyhow::Error> {
let definition = make_definition(deps, &cli, &format!("api_deployment_deploy{name}"))?;
let definition = make_definition(deps, &cli, &format!("api_deployment_deploy{name}"), None)?;
let host = format!("deploy-host{name}");
let cfg = &cli.config;

Expand Down Expand Up @@ -158,7 +159,7 @@ fn api_deployment_deploy(
fn api_deployment_get(
(deps, name, cli): (&EnvBasedTestDependencies, String, CliLive),
) -> Result<(), anyhow::Error> {
let definition = make_definition(deps, &cli, &format!("api_deployment_get{name}"))?;
let definition = make_definition(deps, &cli, &format!("api_deployment_get{name}"), None)?;
let host = format!("get-host{name}");
let cfg = &cli.config;

Expand All @@ -183,7 +184,7 @@ fn api_deployment_get(
fn api_deployment_list(
(deps, name, cli): (&EnvBasedTestDependencies, String, CliLive),
) -> Result<(), anyhow::Error> {
let definition = make_definition(deps, &cli, &format!("api_deployment_list{name}"))?;
let definition = make_definition(deps, &cli, &format!("api_deployment_list{name}"), None)?;
let host = format!("list-host{name}");
let cfg = &cli.config;

Expand Down Expand Up @@ -214,7 +215,7 @@ fn api_deployment_list(
fn api_deployment_delete(
(deps, name, cli): (&EnvBasedTestDependencies, String, CliLive),
) -> Result<(), anyhow::Error> {
let definition = make_definition(deps, &cli, &format!("api_deployment_delete{name}"))?;
let definition = make_definition(deps, &cli, &format!("api_deployment_delete{name}"), None)?;
let host = format!("delete-host{name}");
let cfg = &cli.config;

Expand Down
2 changes: 1 addition & 1 deletion golem-cli/tests/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn top_level_get_api_deployment(
cli: &CliLive,
_tracing: &Tracing,
) -> Result<(), anyhow::Error> {
let definition = make_definition(deps, cli, "top_level_get_api_deployment")?;
let definition = make_definition(deps, cli, "top_level_get_api_deployment", None)?;
let host = "get-host-top-level-get";
let cfg = &cli.config;

Expand Down
3 changes: 3 additions & 0 deletions golem-cli/tests/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ fn text_api_deployment_deploy(
deps,
&cli,
&format!("text_api_deployment_deploy{name}"),
None,
)?;
let host = format!("text-deploy-host{name}");
let cfg = &cli.config;
Expand Down Expand Up @@ -730,6 +731,7 @@ fn text_api_deployment_get(
deps,
&cli,
&format!("text_api_deployment_get{name}"),
None,
)?;
let host = format!("text-get-host{name}");
let cfg = &cli.config;
Expand Down Expand Up @@ -771,6 +773,7 @@ fn text_api_deployment_list(
deps,
&cli,
&format!("text_api_deployment_list{name:_>9}"),
None,
)?;
let host = format!("text-list-host{name:->9}");
let cfg = &cli.config;
Expand Down

0 comments on commit a6b6cfa

Please sign in to comment.