Skip to content

Commit

Permalink
fix: fixed relative volumes again
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoverson committed Jul 28, 2023
1 parent d67c115 commit d901966
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ _wick-http-tests:
_wick-component-tests:
{{wick}} test ./examples/components/hello-world.wick
{{wick}} test ./examples/components/composite-db-import.wick
DIR=./examples/components/wasi-fs/ {{wick}} test ./examples/components/wasi-fs/component.wick
{{wick}} test ./examples/components/wasi-fs/component.wick

# Run component-codegen unit tests
_codegen-tests:
Expand Down
2 changes: 1 addition & 1 deletion crates/bins/wick/src/commands/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(crate) async fn handle(
) -> Result<StructuredOutput> {
let fetch_options: wick_oci_utils::OciOptions = opts.oci.clone().into();

let manifest = WickConfiguration::fetch_all(&opts.location, fetch_options)
let manifest = WickConfiguration::fetch(&opts.location, fetch_options)
.await?
.finish()?
.try_component_config()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/bins/wick/src/commands/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) async fn handle(

let with_config = parse_config_string(opts.with.as_deref())?;

let mut manifest = WickConfiguration::fetch_all(&opts.location, fetch_options).await?;
let mut manifest = WickConfiguration::fetch(&opts.location, fetch_options).await?;
manifest.set_root_config(with_config);
let manifest = manifest.finish()?.try_component_config()?;

Expand Down
4 changes: 2 additions & 2 deletions crates/bins/wick/src/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ pub(crate) async fn handle(
span: tracing::Span,
) -> Result<StructuredOutput> {
let oci_opts: OciOptions = opts.oci.clone().into();
let root_manifest = WickConfiguration::fetch_all(&opts.location, oci_opts.clone())
let root_manifest = WickConfiguration::fetch(&opts.location, oci_opts.clone())
.await?
.into_inner()
.try_component_config()?;

let mut suite = TestSuite::from_configuration(root_manifest.tests())?;

let test_files: Vec<_> = futures::future::join_all(opts.tests.iter().map(|path| {
WickConfiguration::fetch_all(path, oci_opts.clone())
WickConfiguration::fetch(path, oci_opts.clone())
.and_then(|config| futures::future::ready(config.finish().and_then(|c| c.try_test_config())))
}))
.await
Expand Down
2 changes: 1 addition & 1 deletion crates/bins/wick/src/wick_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub(crate) async fn build_component_host(
fetch_opts.set_cache_dir(path_dir.join(env.local().cache()));
};

let mut manifest = WickConfiguration::fetch_all(path, fetch_opts).await?;
let mut manifest = WickConfiguration::fetch(path, fetch_opts).await?;
manifest.set_root_config(root_config);
let manifest = manifest.finish()?.try_component_config()?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro_rules! binary_interleaved_pairs {
($name:ident) => {
#[async_trait::async_trait(?Send)]
impl $name::Operation for Component {
type Error = anyhow::Error;
type Error = Box<dyn std::error::Error + 'static>;
type Outputs = $name::Outputs;
type Config = $name::Config;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro_rules! binary_paired_right_stream {
($name:ident) => {
#[async_trait::async_trait(?Send)]
impl $name::Operation for Component {
type Error = anyhow::Error;
type Error = Box<dyn std::error::Error + 'static>;
type Outputs = $name::Outputs;
type Config = $name::Config;

Expand Down
2 changes: 1 addition & 1 deletion crates/wick/wick-component/src/adapters/unary/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro_rules! unary_simple {
($name:ident) => {
#[async_trait::async_trait(?Send)]
impl $name::Operation for Component {
type Error = anyhow::Error;
type Error = Box<dyn std::error::Error + 'static>;
type Outputs = $name::Outputs;
type Config = $name::Config;

Expand Down
1 change: 1 addition & 0 deletions crates/wick/wick-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ impl WickConfiguration {
.path()
.unwrap_or_else(|e| PathBuf::from(format!("<ERROR:{}>", e)));
let config = WickConfiguration::load_from_bytes(&bytes, &Some(source))?;
config.manifest.update_baseurls();
match &config.manifest {
WickConfiguration::Component(c) => {
c.setup_cache(options).await?;
Expand Down
3 changes: 0 additions & 3 deletions crates/wick/wick-config/src/config/common/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ impl asset_container::AssetManager for Volume {
}

fn set_baseurl(&self, baseurl: &std::path::Path) {
#[allow(clippy::option_if_let_else)]
if let Some(path) = &self.path.value {
path.update_baseurl(baseurl);
match self.path() {
Expand All @@ -235,8 +234,6 @@ impl asset_container::AssetManager for Volume {
tracing::warn!(%path,error=%e,"volume path could not be resolved");
}
}
} else {
tracing::error!("could not update baseurl: {}", baseurl.display());
}
}

Expand Down
8 changes: 5 additions & 3 deletions crates/wick/wick-config/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ pub(crate) fn resolve_configuration(src: &str, source: &Option<PathBuf>) -> Resu
0 => {
let host_config = serde_yaml::from_str::<v0::HostManifest>(src)
.map_err(|e| Error::YamlError(source.clone(), e.to_string(), e.location()))?;
Ok(UninitializedConfiguration::new(WickConfiguration::Component(
host_config.try_into()?,
)))
let mut config = WickConfiguration::Component(host_config.try_into()?);
if let Some(src) = source {
config.set_source(src);
}
Ok(UninitializedConfiguration::new(config))
}
1 => {
let base_config = serde_yaml::from_str::<v1::WickConfig>(src)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ network:
collections:
- namespace: wasmrs
kind: WaPC
reference: ../../integration/test-baseline-component/build/baseline.signed.wasm
reference: ../../../../../integration/test-baseline-component/build/baseline.signed.wasm
data:
default_err: 'custom error'
schematics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ network:
collections:
- namespace: wapc
kind: WaPC
reference: ../../integration/test-baseline-component/build/baseline.signed.wasm
reference: ../../../../../integration/test-baseline-component/build/baseline.signed.wasm
data:
default_err: 'error from global-collection-def.yaml'
schematics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ network:
collections:
- namespace: wapc
kind: WaPC
reference: ../../integration/test-baseline-component/build/baseline.signed.wasm
reference: ../../../../../integration/test-baseline-component/build/baseline.signed.wasm
data:
default_err: 'error from short-circuit.yaml'
schematics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ network:
collections:
- namespace: wapc
kind: WaPC
reference: ../../integration/test-baseline-component/build/baseline.signed.wasm
reference: ../../../../../integration/test-baseline-component/build/baseline.signed.wasm
data:
default_err: 'error from sub-network-child.yaml'
schematics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ network:
collections:
- namespace: subnet
kind: Network
reference: ./tests/manifests/v0/sub-network-child.yaml
reference: ./sub-network-child.yaml
schematics:
- name: parent
instances:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ network:
collections:
- namespace: wapc
kind: WaPC
reference: ../../integration/test-baseline-component/build/baseline.signed.wasm
reference: ../../../../../integration/test-baseline-component/build/baseline.signed.wasm
data:
default_err: 'custom error'
schematics:
Expand Down
2 changes: 1 addition & 1 deletion examples/components/wasi-fs/component.wick
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ component:
# type: int
tests:
- with:
root: '{{ctx.env.DIR}}'
root: '.'
cases:
- operation: read_string
inputs:
Expand Down
13 changes: 1 addition & 12 deletions tests/codegen-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,10 @@ publish = false

[dependencies]
wick-component-codegen = { workspace = true }
wick-logger = { workspace = true }

[[bin]]
name = "test-codegen"
path = "src/main.rs"

[build-dependencies]
# wick-rpc = { workspace = true }
# tracing = { workspace = true }
# futures = { workspace = true }
# test-logger = { workspace = true }
# tokio = { workspace = true, features = ["macros", "process", "rt"] }
# wick-logger = { workspace = true }
# clap = { version = "3.0", features = ["derive", "env"] }
# pretty_assertions = { workspace = true }
# wick-component-cli = { workspace = true }
# tonic = { workspace = true }
# wick-invocation-server = { workspace = true }
# tokio-stream = { workspace = true }
12 changes: 12 additions & 0 deletions tests/codegen-bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use wick_logger::LoggingOptions;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let spec = std::env::args().nth(1).unwrap();
let dir = std::env::args().nth(2).unwrap();
Expand All @@ -6,6 +8,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}

fn gen(spec: &str, dir: &str) -> Result<(), Box<dyn std::error::Error>> {
let _guard = wick_logger::init(&LoggingOptions {
verbose: true,
silly: true,
level: wick_logger::LogLevel::Trace,
log_json: false,
log_dir: None,
otlp_endpoint: None,
app_name: "codegen-bin".to_owned(),
global: true,
});
println!("Generating code from {} in {}", spec, dir);
wick_component_codegen::configure().out_dir(dir).generate(spec)?;

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen-tests/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ codegen:

test:
cargo test
cargo run --manifest-path ../../crates/bins/wick/Cargo.toml -- test tests/testdata/import-types.wick
cargo run --manifest-path ../../crates/bins/wick/Cargo.toml -- test tests/testdata/import-types.wick --trace
2 changes: 1 addition & 1 deletion tests/integration/src/test/wick_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async fn baseline_component() -> Result<()> {

let fetch_options = wick_config::FetchOptions::default();

let mut root_manifest = WickConfiguration::fetch_all(manifest.to_string_lossy(), fetch_options).await?;
let mut root_manifest = WickConfiguration::fetch(manifest.to_string_lossy(), fetch_options).await?;
root_manifest.set_root_config(Some(RuntimeConfig::from(HashMap::from([(
"default_err".into(),
"err".into(),
Expand Down

0 comments on commit d901966

Please # to comment.