diff --git a/bin/module-index/BUCK b/bin/module-index/BUCK index ae2fc829d9..3f25618d7e 100644 --- a/bin/module-index/BUCK +++ b/bin/module-index/BUCK @@ -21,7 +21,6 @@ rust_binary( "dev.jwt_signing_public_key.pem": "//config/keys:dev.jwt_signing_public_key.pem", "prod.jwt_signing_public_key.pem": "//config/keys:prod.jwt_signing_public_key.pem", "dev.postgres.root.crt": "//config/keys:dev.postgres.root.crt", -# "pkgs_path": "//pkgs:pkgs", }, ) diff --git a/lib/dal-test/src/test_exclusive_schemas/fake_butane.rs b/lib/dal-test/src/test_exclusive_schemas/fake_butane.rs new file mode 100644 index 0000000000..e3eae73937 --- /dev/null +++ b/lib/dal-test/src/test_exclusive_schemas/fake_butane.rs @@ -0,0 +1,230 @@ +use dal::func::argument::FuncArgumentKind; +use dal::pkg::import_pkg_from_pkg; +use dal::{BuiltinsResult, DalContext}; +use dal::{ComponentType, PropKind}; +use si_pkg::{ + AttrFuncInputSpec, AttrFuncInputSpecKind, FuncArgumentSpec, FuncSpec, FuncSpecBackendKind, + FuncSpecBackendResponseType, FuncSpecData, PkgSpec, PropSpec, PropSpecWidgetKind, SchemaSpec, + SchemaVariantSpec, SchemaVariantSpecData, SiPkg, SocketSpecArity, +}; +use si_pkg::{SchemaSpecData, SocketSpec, SocketSpecData, SocketSpecKind}; + +use crate::test_exclusive_schemas::{ + build_asset_func, create_identity_func, PKG_CREATED_BY, PKG_VERSION, +}; + +pub(crate) async fn migrate_test_exclusive_schema_fake_butane( + ctx: &DalContext, +) -> BuiltinsResult<()> { + let mut builder = PkgSpec::builder(); + + let schema_name = "Butane"; + + builder + .name(schema_name) + .version(PKG_VERSION) + .created_by(PKG_CREATED_BY); + + let identity_func_spec = create_identity_func()?; + + let fn_name = "test:scaffoldFakeButane"; + let authoring_schema_func = build_asset_func(fn_name)?; + + let code = "async function main(input: Input): Promise < Output > { + if (input.images === undefined || input.images === null) return []; + let images = Array.isArray(input.images) ? input.images : [input.images]; + + let units: any[] = []; + + images + .filter((i: any) => i ?? false) + .forEach(function(dockerImage: any) { + let name = dockerImage.si.name + .replace(/[^A-Za-z0-9]/g, '-') + .replace(/-+$/, '') + .toLowerCase(); + let unit: Record < string, any > = { + name: name + '.service', + enabled: true, + }; + + let ports = ''; + let dockerImageExposedPorts = dockerImage.domain.ExposedPorts; + if ( + !( + dockerImageExposedPorts === undefined || + dockerImageExposedPorts === null + ) + ) { + dockerImageExposedPorts.forEach(function(dockerImageExposedPort: any) { + if ( + !( + dockerImageExposedPort === undefined || + dockerImageExposedPort === null + ) + ) { + let parts = dockerImageExposedPort.split('/'); + try { + // Prefix with a blank space. + ports = ports + ` --publish ${parts[0]}:${parts[0]}`; + } catch (err) {} + } + }); + } + + let image = dockerImage.domain.image; + let defaultDockerHost = 'docker.io'; + let imageParts = image.split('/'); + if (imageParts.length === 1) { + image = [defaultDockerHost, 'library', imageParts[0]].join('/'); + } else if (imageParts.length === 2) { + image = [defaultDockerHost, imageParts[0], imageParts[1]].join('/'); + } + + let description = name.charAt(0).toUpperCase() + name.slice(1); + + unit.contents = `[Unit]\nDescription=${description}\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nTimeoutStartSec=0\nExecStartPre=-/bin/podman kill ${name}\nExecStartPre=-/bin/podman rm ${name}\nExecStartPre=/bin/podman pull ${image}\nExecStart=/bin/podman run --name ${name}${ports} ${image}\n\n[Install]\nWantedBy=multi-user.target`; + + units.push(unit); + }); + + return units; + }"; + let fn_name = "test:dockerImagesToButaneUnits"; + let docker_images_to_butane_units_func_spec = FuncSpec::builder() + .name(fn_name) + .unique_id(fn_name) + .data( + FuncSpecData::builder() + .name(fn_name) + .code_plaintext(code) + .handler("main") + .backend_kind(FuncSpecBackendKind::JsAttribute) + .response_type(FuncSpecBackendResponseType::Array) + .build()?, + ) + .argument( + FuncArgumentSpec::builder() + .name("images") + .kind(FuncArgumentKind::Array) + .element_kind(Some(FuncArgumentKind::Object.into())) + .build()?, + ) + .build()?; + + let schema = SchemaSpec::builder() + .name(schema_name) + .data( + SchemaSpecData::builder() + .name(schema_name) + .category("test exclusive") + .category_name(schema_name) + .build()?, + ) + .variant( + SchemaVariantSpec::builder() + .version("v0") + .unique_id("butane_sv") + .data( + SchemaVariantSpecData::builder() + .version("v0") + .color("#ffffff") + .func_unique_id(&authoring_schema_func.unique_id) + .component_type(ComponentType::Component) + .build()?, + ) + .domain_prop( + PropSpec::builder() + .name("version") + .kind(PropKind::String) + .default_value(serde_json::json!("1.4.0")) + .widget_kind(PropSpecWidgetKind::Text) + .build()?, + ) + .domain_prop( + PropSpec::builder() + .name("variant") + .kind(PropKind::String) + .default_value(serde_json::json!("fcos")) + .widget_kind(PropSpecWidgetKind::Text) + .build()?, + ) + .domain_prop( + PropSpec::builder() + .name("systemd") + .kind(PropKind::Object) + .entry( + PropSpec::builder() + .name("units") + .kind(PropKind::Array) + .func_unique_id(&docker_images_to_butane_units_func_spec.unique_id) + .input( + AttrFuncInputSpec::builder() + .kind(AttrFuncInputSpecKind::InputSocket) + .name("images") + .socket_name("Container Image") + .build()?, + ) + .type_prop( + PropSpec::builder() + .name("unit") + .kind(PropKind::Object) + .entry( + PropSpec::builder() + .name("name") + .kind(PropKind::String) + .widget_kind(PropSpecWidgetKind::Text) + .build()?, + ) + .entry( + PropSpec::builder() + .name("enabled") + .kind(PropKind::Boolean) + .widget_kind(PropSpecWidgetKind::Checkbox) + .build()?, + ) + .entry( + PropSpec::builder() + .name("contents") + .kind(PropKind::String) + .widget_kind(PropSpecWidgetKind::TextArea) + .build()?, + ) + .build()?, + ) + .build()?, + ) + .build()?, + ) + .socket( + SocketSpec::builder() + .name("Container Image") + .data( + SocketSpecData::builder() + .name("Container Image") + .kind(SocketSpecKind::Input) + .arity(SocketSpecArity::Many) + .func_unique_id(&identity_func_spec.unique_id) + .connection_annotations(serde_json::to_string(&vec![ + "Container Image", + ])?) + .build()?, + ) + .build()?, + ) + .build()?, + ) + .build()?; + + let spec = builder + .func(identity_func_spec) + .func(authoring_schema_func) + .func(docker_images_to_butane_units_func_spec) + .schema(schema) + .build()?; + + let pkg = SiPkg::load_from_spec(spec)?; + import_pkg_from_pkg(ctx, &pkg, None).await?; + + Ok(()) +} diff --git a/lib/dal-test/src/test_exclusive_schemas/fake_docker_image.rs b/lib/dal-test/src/test_exclusive_schemas/fake_docker_image.rs new file mode 100644 index 0000000000..f2f43485e9 --- /dev/null +++ b/lib/dal-test/src/test_exclusive_schemas/fake_docker_image.rs @@ -0,0 +1,120 @@ +use dal::pkg::import_pkg_from_pkg; +use dal::prop::PropPath; +use dal::ComponentType; +use dal::{BuiltinsResult, DalContext}; +use si_pkg::{ + AttrFuncInputSpec, AttrFuncInputSpecKind, PkgSpec, PropSpec, PropSpecKind, PropSpecWidgetKind, + SchemaSpec, SchemaVariantSpec, SchemaVariantSpecData, SiPkg, SocketSpecArity, SocketSpecData, + SocketSpecKind, +}; +use si_pkg::{SchemaSpecData, SocketSpec}; + +use crate::test_exclusive_schemas::{ + build_asset_func, create_identity_func, PKG_CREATED_BY, PKG_VERSION, +}; + +pub(crate) async fn migrate_test_exclusive_schema_fake_docker_image( + ctx: &DalContext, +) -> BuiltinsResult<()> { + let mut builder = PkgSpec::builder(); + + let schema_name = "Docker Image"; + + builder + .name(schema_name) + .version(PKG_VERSION) + .created_by(PKG_CREATED_BY); + + let identity_func_spec = create_identity_func()?; + + let fn_name = "test:scaffoldFakeDockerImage"; + let authoring_schema_func = build_asset_func(fn_name)?; + + let schema = SchemaSpec::builder() + .name(schema_name) + .data( + SchemaSpecData::builder() + .name(schema_name) + .category("test exclusive") + .category_name(schema_name) + .build()?, + ) + .variant( + SchemaVariantSpec::builder() + .version("v0") + .unique_id("docker_image_sv") + .data( + SchemaVariantSpecData::builder() + .version("v0") + .color("#ffffff") + .func_unique_id(&authoring_schema_func.unique_id) + .component_type(ComponentType::Component) + .build()?, + ) + .domain_prop( + PropSpec::builder() + .name("image") + .kind(PropSpecKind::String) + .func_unique_id(&identity_func_spec.unique_id) + .widget_kind(PropSpecWidgetKind::Text) + .input( + AttrFuncInputSpec::builder() + .kind(AttrFuncInputSpecKind::Prop) + .name("identity") + .prop_path(PropPath::new(["root", "si", "name"])) + .build()?, + ) + .build()?, + ) + .domain_prop( + PropSpec::builder() + .name("ExposedPorts") + .kind(PropSpecKind::Array) + .widget_kind(PropSpecWidgetKind::Array) + .type_prop( + PropSpec::builder() + .name("ExposedPort") + .kind(PropSpecKind::String) + .widget_kind(PropSpecWidgetKind::Text) + .build()?, + ) + .build()?, + ) + .socket( + SocketSpec::builder() + .name("Container Image") + .data( + SocketSpecData::builder() + .name("Container Image") + .kind(SocketSpecKind::Output) + .arity(SocketSpecArity::Many) + .func_unique_id(&identity_func_spec.unique_id) + .connection_annotations(serde_json::to_string(&vec![ + "Container Image", + ])?) + .build()?, + ) + .input( + AttrFuncInputSpec::builder() + .kind(AttrFuncInputSpecKind::Prop) + .name("identity") + .prop_path(PropPath::new(["root"])) + .build()?, + ) + .build()?, + ) + .build()?, + ) + .build()?; + + let spec = builder + .func(identity_func_spec) + .func(authoring_schema_func) + .schema(schema) + .build()?; + + let pkg = SiPkg::load_from_spec(spec)?; + import_pkg_from_pkg(ctx, &pkg, None).await?; + + Ok(()) +} diff --git a/lib/dal-test/src/test_exclusive_schemas/mod.rs b/lib/dal-test/src/test_exclusive_schemas/mod.rs index 54dd777df4..c34a93f749 100644 --- a/lib/dal-test/src/test_exclusive_schemas/mod.rs +++ b/lib/dal-test/src/test_exclusive_schemas/mod.rs @@ -1,13 +1,20 @@ +use base64::engine::general_purpose; +use base64::Engine; use category_pirate::migrate_test_exclusive_schema_pet_shop; use category_pirate::migrate_test_exclusive_schema_pirate; use category_validated::migrate_test_exclusive_schema_bad_validations; use category_validated::migrate_test_exclusive_schema_validated_input; use category_validated::migrate_test_exclusive_schema_validated_output; -use dal::builtins::schema; +use dal::func::argument::FuncArgument; use dal::func::argument::FuncArgumentKind; use dal::func::intrinsics::IntrinsicFunc; -use dal::{BuiltinsError, BuiltinsResult, DalContext}; +use dal::Func; +use dal::FuncBackendKind; +use dal::FuncBackendResponseType; +use dal::{BuiltinsResult, DalContext}; use dummy_secret::migrate_test_exclusive_schema_dummy_secret; +use fake_butane::migrate_test_exclusive_schema_fake_butane; +use fake_docker_image::migrate_test_exclusive_schema_fake_docker_image; use fallout::migrate_test_exclusive_schema_fallout; use katy_perry::migrate_test_exclusive_schema_katy_perry; use legos::migrate_test_exclusive_schema_large_even_lego; @@ -27,6 +34,8 @@ use swifty::migrate_test_exclusive_schema_swifty; mod category_pirate; mod category_validated; mod dummy_secret; +mod fake_butane; +mod fake_docker_image; mod fallout; mod katy_perry; mod legos; @@ -35,12 +44,9 @@ mod swifty; const PKG_VERSION: &str = "2019-06-03"; const PKG_CREATED_BY: &str = "System Initiative"; -const SI_DOCKER_IMAGE_PKG: &str = "si-docker-image-2023-09-13.sipkg"; -const SI_COREOS_PKG: &str = "si-coreos-2023-09-13.sipkg"; pub(crate) async fn migrate(ctx: &DalContext) -> BuiltinsResult<()> { - schema::migrate_pkg(ctx, SI_DOCKER_IMAGE_PKG, None).await?; - schema::migrate_pkg(ctx, SI_COREOS_PKG, None).await?; + migrate_test_exclusive_func_si_resource_payload_to_value(ctx).await?; migrate_test_exclusive_schema_starfield(ctx).await?; migrate_test_exclusive_schema_etoiles(ctx).await?; migrate_test_exclusive_schema_morningstar(ctx).await?; @@ -59,6 +65,45 @@ pub(crate) async fn migrate(ctx: &DalContext) -> BuiltinsResult<()> { migrate_test_exclusive_schema_medium_odd_lego(ctx).await?; migrate_test_exclusive_schema_small_odd_lego(ctx).await?; migrate_test_exclusive_schema_small_even_lego(ctx).await?; + migrate_test_exclusive_schema_fake_docker_image(ctx).await?; + migrate_test_exclusive_schema_fake_butane(ctx).await?; + Ok(()) +} + +// TODO(nick): remove this if "si:resourcePayloadToValue" becomes an instrinsic func. +async fn migrate_test_exclusive_func_si_resource_payload_to_value( + ctx: &DalContext, +) -> BuiltinsResult<()> { + let func_name = "si:resourcePayloadToValue"; + + let func_id = match Func::find_id_by_name(ctx, func_name).await? { + Some(existing_func_id) => existing_func_id, + None => { + let new_func = Func::new( + ctx, + func_name, + None::, + None::, + None::, + false, + true, + FuncBackendKind::JsAttribute, + FuncBackendResponseType::Json, + Some("main"), + Some(general_purpose::STANDARD_NO_PAD.encode("async function main(arg: Input): Promise { return arg.payload ?? {}; }")), + ) + .await?; + new_func.id + } + }; + + if FuncArgument::find_by_name_for_func(ctx, "payload", func_id) + .await? + .is_none() + { + FuncArgument::new(ctx, "payload", FuncArgumentKind::Object, None, func_id).await?; + } + Ok(()) } @@ -94,7 +139,7 @@ fn build_resource_payload_to_value_func() -> BuiltinsResult { Ok(resource_payload_to_value_func) } -fn build_action_func(code: &str, fn_name: &str) -> Result { +fn build_action_func(code: &str, fn_name: &str) -> BuiltinsResult { let func = FuncSpec::builder() .name(fn_name) .unique_id(fn_name) diff --git a/lib/dal-test/src/test_exclusive_schemas/swifty.rs b/lib/dal-test/src/test_exclusive_schemas/swifty.rs index be32481095..5175d137c1 100644 --- a/lib/dal-test/src/test_exclusive_schemas/swifty.rs +++ b/lib/dal-test/src/test_exclusive_schemas/swifty.rs @@ -3,9 +3,10 @@ use dal::pkg::import_pkg_from_pkg; use dal::{prop::PropPath, ComponentType}; use dal::{BuiltinsResult, DalContext, PropKind}; use si_pkg::{ - ActionFuncSpec, AttrFuncInputSpec, AttrFuncInputSpecKind, LeafInputLocation, LeafKind, PkgSpec, - PropSpec, SchemaSpec, SchemaVariantSpec, SchemaVariantSpecData, SiPkg, SocketSpec, - SocketSpecData, SocketSpecKind, + ActionFuncSpec, AttrFuncInputSpec, AttrFuncInputSpecKind, FuncSpec, FuncSpecBackendKind, + FuncSpecBackendResponseType, FuncSpecData, LeafInputLocation, LeafKind, PkgSpec, PropSpec, + SchemaSpec, SchemaVariantSpec, SchemaVariantSpecData, SiPkg, SocketSpec, SocketSpecData, + SocketSpecKind, }; use si_pkg::{LeafFunctionSpec, SchemaSpecData}; @@ -74,6 +75,9 @@ pub(crate) async fn migrate_test_exclusive_schema_swifty(ctx: &DalContext) -> Bu }"; let code_gen_func = build_codegen_func(codegen_func_code, codegen_fn_name)?; + // Assemble Qualification Func + let (qualification_func_spec, qualfiication_leaf_func_spec) = assemble_qualification()?; + let swifty_schema = SchemaSpec::builder() .name(schema_name) .data( @@ -164,6 +168,7 @@ pub(crate) async fn migrate_test_exclusive_schema_swifty(ctx: &DalContext) -> Bu .inputs(vec![LeafInputLocation::Domain]) .build()?, ) + .leaf_function(qualfiication_leaf_func_spec) .build()?, ) .build()?; @@ -177,6 +182,7 @@ pub(crate) async fn migrate_test_exclusive_schema_swifty(ctx: &DalContext) -> Bu .func(swifty_authoring_schema_func) .func(resource_payload_to_value_func) .func(code_gen_func) + .func(qualification_func_spec) .schema(swifty_schema) .build()?; @@ -185,3 +191,34 @@ pub(crate) async fn migrate_test_exclusive_schema_swifty(ctx: &DalContext) -> Bu Ok(()) } + +fn assemble_qualification() -> BuiltinsResult<(FuncSpec, LeafFunctionSpec)> { + let fn_code = "async function qualification(_component: Input): Promise {\ + return { + result: 'success', + message: 'this cannot fail' + }; + }"; + let fn_name = "test:swiftyQualification"; + let func_spec = FuncSpec::builder() + .name(fn_name) + .unique_id(fn_name) + .data( + FuncSpecData::builder() + .name(fn_name) + .code_plaintext(fn_code) + .handler("qualification") + .backend_kind(FuncSpecBackendKind::JsAttribute) + .response_type(FuncSpecBackendResponseType::Qualification) + .build()?, + ) + .build()?; + + let leaf_function_spec = LeafFunctionSpec::builder() + .func_unique_id(&func_spec.unique_id) + .leaf_kind(LeafKind::Qualification) + .inputs(vec![LeafInputLocation::Domain]) + .build()?; + + Ok((func_spec, leaf_function_spec)) +} diff --git a/lib/dal/src/builtins.rs b/lib/dal/src/builtins.rs index d1d321a535..eafd535db2 100644 --- a/lib/dal/src/builtins.rs +++ b/lib/dal/src/builtins.rs @@ -3,12 +3,12 @@ //! [migrate()](crate::builtins::migrate_local()) function. However, they may have some functionality //! exposed for "dev mode" use cases. -use std::collections::HashSet; use telemetry::prelude::*; use thiserror::Error; use si_pkg::{SiPkgError, SpecError}; +use crate::func::argument::FuncArgumentError; use crate::func::FuncError; use crate::module::ModuleError; use crate::pkg::PkgError; @@ -17,7 +17,6 @@ use crate::{ SchemaVariantId, StandardModelError, TransactionsError, }; -// Private builtins modules. pub mod func; pub mod schema; @@ -30,39 +29,41 @@ pub enum BuiltinsError { AttributeValueNotFound(AttributeValueId), #[error("builtin {0} missing func argument {1}")] BuiltinMissingFuncArgument(String, String), - #[error("Filesystem IO error: {0}")] - FilesystemIO(#[from] std::io::Error), - #[error(transparent)] + #[error("func error")] Func(#[from] FuncError), + #[error("func argument error: {0}")] + FuncArgument(#[from] FuncArgumentError), #[error("json error {1} at file {0}")] FuncJson(String, serde_json::Error), - #[error("Func Metadata error: {0}")] + #[error("func metadata error: {0}")] FuncMetadata(String), #[error("func not found in migration cache {0}")] FuncNotFoundInMigrationCache(&'static str), + #[error("io error: {0}")] + Io(#[from] std::io::Error), #[error("missing attribute prototype for attribute value")] MissingAttributePrototypeForAttributeValue, #[error("no packages path configured")] MissingPkgsPath, - #[error(transparent)] + #[error("module error: {0}")] Module(#[from] ModuleError), - #[error(transparent)] + #[error("pkg error: {0}")] Pkg(#[from] PkgError), #[error("prop cache not found: {0}")] PropCacheNotFound(SchemaVariantId), #[error("prop not bound by id: {0}")] PropNotFound(PropId), - #[error("Regex parsing error: {0}")] + #[error("regex parsing error: {0}")] Regex(#[from] regex::Error), - #[error(transparent)] + #[error("schema variant error: {0}")] SchemaVariant(#[from] SchemaVariantError), #[error("serde json error: {0}")] SerdeJson(#[from] serde_json::Error), #[error("encountered serde json error for func ({0}): {1}")] SerdeJsonErrorForFunc(String, serde_json::Error), - #[error(transparent)] + #[error("si pkg error: {0}")] SiPkg(#[from] SiPkgError), - #[error(transparent)] + #[error("spec error: {0}")] Spec(#[from] SpecError), #[error("standard model error: {0}")] StandardModel(#[from] StandardModelError), @@ -71,19 +72,3 @@ pub enum BuiltinsError { } pub type BuiltinsResult = Result; - -/// This enum drives what builtin [`Schemas`](crate::Schema) to migrate for tests. -/// -/// This enum _should not_ be used outside of tests! -#[remain::sorted] -#[derive(Debug, Clone, Eq, PartialEq)] -pub enum SelectedTestBuiltinSchemas { - /// Migrate everything (default behavior). - All, - /// Migrate nothing. - None, - /// Migrate _some_ [`Schema(s)`](crate::Schema) based on user input. - Some(HashSet), - /// Migrate _only_ test-exclusive [`Schemas`](crate::Schema). - Test, -} diff --git a/lib/dal/tests/integration_test/builtins.rs b/lib/dal/tests/integration_test/builtins.rs deleted file mode 100644 index 711595888c..0000000000 --- a/lib/dal/tests/integration_test/builtins.rs +++ /dev/null @@ -1,79 +0,0 @@ -use dal::workspace_snapshot::edge_weight::EdgeWeightKindDiscriminants; -use dal::{func::intrinsics::IntrinsicFunc, DalContext, Func, Schema, SchemaVariant}; -use dal_test::test; -use strum::IntoEnumIterator; - -#[test] -async fn docker_image_has_one_qualfiication_map_prop(ctx: &DalContext) { - let docker_image = Schema::list(ctx) - .await - .expect("list schemas") - .iter() - .find(|schema| schema.name() == "Docker Image") - .expect("docker image does not exist") - .to_owned(); - - let variant = SchemaVariant::list_for_schema(ctx, docker_image.id()) - .await - .expect("get schema variants") - .pop() - .expect("get default variant"); - - let root_prop_id = SchemaVariant::get_root_prop_id(ctx, variant.id()) - .await - .expect("get root prop for variant"); - - let workspace_snapshot = ctx.workspace_snapshot().expect("get snap"); - - let child_prop_targets = workspace_snapshot - .outgoing_targets_for_edge_weight_kind(root_prop_id, EdgeWeightKindDiscriminants::Use) - .await - .expect("get all child prop targets of root"); - - let mut qualification_props = vec![]; - - for node_index in child_prop_targets { - let node_weight = workspace_snapshot - .get_node_weight(node_index) - .await - .expect("get node weight") - .get_prop_node_weight() - .expect("should be prop") - .to_owned(); - - if node_weight.name() == "qualification" { - qualification_props.push(node_index) - } - } - - assert_eq!(1, qualification_props.len()); -} - -#[test] -async fn builtin_funcs_and_schemas_are_not_empty(ctx: &DalContext) { - let funcs: Vec = Func::list_all(ctx) - .await - .expect("list funcs should work") - .iter() - .map(|f| f.name.to_owned()) - .collect(); - - // Check that the funcs at least contain all intrinsics. - let intrinsics: Vec = IntrinsicFunc::iter() - .map(|intrinsic| intrinsic.name().to_owned()) - .collect(); - for intrinsic in intrinsics { - assert!(funcs.contains(&intrinsic)); - } - - // Ensure that we have at least one schema variant for every schema and that we have at least - // one schema. - let schemas: Vec = Schema::list(ctx).await.expect("could not list schemas"); - assert!(!schemas.is_empty()); - for schema in schemas { - let schema_variants: Vec = SchemaVariant::list_for_schema(ctx, schema.id()) - .await - .expect("could not list schema variants"); - assert!(!schema_variants.is_empty()); - } -} diff --git a/lib/dal/tests/integration_test/diagram.rs b/lib/dal/tests/integration_test/diagram.rs index ef82df31ef..c8221b5636 100644 --- a/lib/dal/tests/integration_test/diagram.rs +++ b/lib/dal/tests/integration_test/diagram.rs @@ -7,11 +7,11 @@ use dal_test::{ #[test] async fn components_removed_from_snapshot_have_virtual_diagram_entries(ctx: &mut DalContext) { let component_to_remove = - create_component_for_default_schema_name(ctx, "Docker Image", "Removed in sub-change set") + create_component_for_default_schema_name(ctx, "starfield", "Removed in sub-change set") .await .expect("Unable to create component."); let _component_still_in_change_set = - create_component_for_default_schema_name(ctx, "Docker Image", "Still here") + create_component_for_default_schema_name(ctx, "starfield", "Still here") .await .expect("Unable to create component."); ChangeSetTestHelpers::commit_and_update_snapshot_to_visibility(ctx) diff --git a/lib/dal/tests/integration_test/mod.rs b/lib/dal/tests/integration_test/mod.rs index 674859adf2..745091c305 100644 --- a/lib/dal/tests/integration_test/mod.rs +++ b/lib/dal/tests/integration_test/mod.rs @@ -1,7 +1,6 @@ mod action; mod asset; mod attribute; -mod builtins; mod change_set; mod component; mod connection; diff --git a/lib/dal/tests/integration_test/module.rs b/lib/dal/tests/integration_test/module.rs index e4c16a398d..d424e92dec 100644 --- a/lib/dal/tests/integration_test/module.rs +++ b/lib/dal/tests/integration_test/module.rs @@ -19,6 +19,8 @@ async fn list_modules(ctx: &DalContext) { let expected_installed_module_names = vec![ "BadValidations".to_string(), + "Butane".to_string(), + "Docker Image".to_string(), "ValidatedInput".to_string(), "ValidatedOutput".to_string(), "dummy-secret".to_string(), @@ -32,8 +34,6 @@ async fn list_modules(ctx: &DalContext) { "morningstar".to_string(), "pet_shop".to_string(), "pirate".to_string(), - "si-coreos-2023-09-13".to_string(), - "si-docker-image-2023-09-13".to_string(), "si-intrinsic-funcs".to_string(), "small even lego".to_string(), "small odd lego".to_string(), diff --git a/lib/dal/tests/integration_test/rebaser.rs b/lib/dal/tests/integration_test/rebaser.rs index 39cff6344e..ab9eafe9be 100644 --- a/lib/dal/tests/integration_test/rebaser.rs +++ b/lib/dal/tests/integration_test/rebaser.rs @@ -371,7 +371,7 @@ async fn delete_func_node(ctx: &mut DalContext) { #[test] async fn correctly_detect_unrelated_unmodified_data(ctx: &mut DalContext) { let shared_component_id = - create_component_for_default_schema_name(ctx, "Docker Image", "Shared component") + create_component_for_default_schema_name(ctx, "swifty", "Shared component") .await .expect("could not create component") .id(); @@ -423,7 +423,7 @@ async fn correctly_detect_unrelated_unmodified_data(ctx: &mut DalContext) { .await .expect("Unable to switch to change set B"); let _change_set_b_component_id = - create_component_for_default_schema_name(ctx, "Docker Image", "Change Set B Component") + create_component_for_default_schema_name(ctx, "swifty", "Change Set B Component") .await .expect("could not creat component") .id(); @@ -450,10 +450,10 @@ async fn correctly_detect_unrelated_unmodified_data(ctx: &mut DalContext) { .expect("Unable to get attribute values for si.name"); assert_eq!(av_ids.len(), 1, "Found more than one AV for si.name"); let av_ids = shared_component - .attribute_values_for_prop(ctx, &["root", "domain", "image"]) + .attribute_values_for_prop(ctx, &["root", "domain", "name"]) .await - .expect("Unable to get attribute values for domain.image"); - assert_eq!(av_ids.len(), 1, "Found more than one AV for domain.image"); + .expect("Unable to get attribute values for domain.name"); + assert_eq!(av_ids.len(), 1, "Found more than one AV for domain.name"); let av_ids = shared_component .attribute_values_for_prop(ctx, &["root", "qualification", "qualificationItem"]) .await @@ -482,10 +482,10 @@ async fn correctly_detect_unrelated_unmodified_data(ctx: &mut DalContext) { .expect("Unable to get attribute values for si.name"); assert_eq!(av_ids.len(), 1, "Found more than one AV for si.name"); let av_ids = shared_component - .attribute_values_for_prop(ctx, &["root", "domain", "image"]) + .attribute_values_for_prop(ctx, &["root", "domain", "name"]) .await - .expect("Unable to get attribute values for domain.image"); - assert_eq!(av_ids.len(), 1, "Found more than one AV for domain.image"); + .expect("Unable to get attribute values for domain.name"); + assert_eq!(av_ids.len(), 1, "Found more than one AV for domain.name"); let av_ids = shared_component .attribute_values_for_prop(ctx, &["root", "qualification", "qualificationItem"]) .await diff --git a/lib/dal/tests/integration_test/schema/variant.rs b/lib/dal/tests/integration_test/schema/variant.rs index c931993db5..11e266b36a 100644 --- a/lib/dal/tests/integration_test/schema/variant.rs +++ b/lib/dal/tests/integration_test/schema/variant.rs @@ -206,6 +206,7 @@ async fn all_funcs(ctx: &DalContext) { "test:deleteActionSwifty", "test:generateCode", "test:refreshActionSwifty", + "test:swiftyQualification", "test:updateActionSwifty", ], all_funcs.as_slice(), diff --git a/lib/dal/tests/integration_test/schema/variant/view.rs b/lib/dal/tests/integration_test/schema/variant/view.rs index cae5bc56c2..48e8a0d1a1 100644 --- a/lib/dal/tests/integration_test/schema/variant/view.rs +++ b/lib/dal/tests/integration_test/schema/variant/view.rs @@ -43,7 +43,7 @@ async fn get_schema_variant(ctx: &DalContext) { .await .expect("Unable to get all schema variant funcs"); - assert_eq!(6, sv_funcs.len()); + assert_eq!(7, sv_funcs.len()); let mut func_names: Vec = sv_funcs.iter().map(|f| f.name.clone()).collect(); func_names.sort(); @@ -53,6 +53,7 @@ async fn get_schema_variant(ctx: &DalContext) { "test:deleteActionSwifty".to_string(), "test:generateCode".to_string(), "test:refreshActionSwifty".to_string(), + "test:swiftyQualification".to_string(), "test:updateActionSwifty".to_string(), ]; assert_eq!(expected, func_names); diff --git a/pkgs/TODO.md b/pkgs/TODO.md new file mode 100644 index 0000000000..7458939a25 --- /dev/null +++ b/pkgs/TODO.md @@ -0,0 +1,7 @@ +# TODO + +This directory, "pkgs", is no longer used. +There are references to it in [prelude-si](../prelude-si) targets that should be removed. + +This directory still exists because the original PR(s) removing the packages were limited in scope and were refactoring work on the side. +I AM BUT ONE MAN! diff --git a/pkgs/si-coreos-2023-09-13.sipkg b/pkgs/si-coreos-2023-09-13.sipkg deleted file mode 100644 index aa61554a37..0000000000 Binary files a/pkgs/si-coreos-2023-09-13.sipkg and /dev/null differ diff --git a/pkgs/si-docker-image-2023-09-13.sipkg b/pkgs/si-docker-image-2023-09-13.sipkg deleted file mode 100644 index daeb2a80f9..0000000000 Binary files a/pkgs/si-docker-image-2023-09-13.sipkg and /dev/null differ