Skip to content

Commit

Permalink
factors: Get factors tests passing with new spin-core
Browse files Browse the repository at this point in the history
Signed-off-by: Lann Martin <[email protected]>
  • Loading branch information
lann committed Jul 19, 2024
1 parent d6a4c37 commit b8a812d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/factor-variables/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
println!("cargo::rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=build.rs");
// Enable spin-factors-derive to emit expanded macro output.
let out_dir = std::env::var("OUT_DIR").unwrap();
println!("cargo:rustc-env=SPIN_FACTORS_DERIVE_EXPAND_DIR={out_dir}");
Expand Down
2 changes: 1 addition & 1 deletion crates/factor-wasi/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
println!("cargo::rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=build.rs");
// Enable spin-factors-derive to emit expanded macro output.
let out_dir = std::env::var("OUT_DIR").unwrap();
println!("cargo:rustc-env=SPIN_FACTORS_DERIVE_EXPAND_DIR={out_dir}");
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/tests/smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async fn smoke_test_works() -> anyhow::Result<()> {
None,
)
.await?;
let app = App::inert(locked);
let app = App::new("test-app", locked);

let engine = wasmtime::Engine::new(wasmtime::Config::new().async_support(true))?;
let mut linker = wasmtime::component::Linker::new(&engine);
Expand Down
3 changes: 2 additions & 1 deletion crates/key-value/src/host_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ impl HostComponent for KeyValueComponent {
}
}

impl DynamicHostComponent for KeyValueComponent {
// impl DynamicHostComponent for KeyValueComponent {
impl HostComponent for KeyValueComponent {
fn update_data(&self, data: &mut Self::Data, component: &AppComponent) -> anyhow::Result<()> {
let key_value_stores = component
.get_metadata(crate::KEY_VALUE_STORES_KEY)?
Expand Down
4 changes: 2 additions & 2 deletions crates/key-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use spin_world::v2::key_value;
use std::{collections::HashSet, sync::Arc};
use table::Table;

mod host_component;
// TODO: Code left for reference; remove after migration to factors
// mod host_component;
mod util;

pub use host_component::{manager, KeyValueComponent};
pub use util::{
CachingStoreManager, DefaultManagerGetter, DelegatingStoreManager, EmptyStoreManager,
};
Expand Down
8 changes: 4 additions & 4 deletions crates/sqlite/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
mod host_component;
// TODO: Code left for reference; remove after migration to factors
// mod host_component;

use spin_app::{async_trait, MetadataKey};
use spin_app::MetadataKey;
use spin_core::wasmtime::component::Resource;
use spin_world::async_trait;
use spin_world::v1::sqlite::Error as V1SqliteError;
use spin_world::v2::sqlite;
use std::{collections::HashSet, sync::Arc};

pub use host_component::SqliteComponent;

pub const DATABASES_KEY: MetadataKey<HashSet<String>> = MetadataKey::new("databases");

/// A store of connections for all accessible databases for an application
Expand Down
5 changes: 4 additions & 1 deletion run-factors-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

# TODO: Remove after enabling CI for factors branch

cargo test -p '*factor*'
cargo test \
-p spin-core \
-p spin-app \
-p '*factor*'

0 comments on commit b8a812d

Please sign in to comment.