Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

add some tests #292

Merged
merged 1 commit into from
Jul 3, 2019
Merged

add some tests #292

merged 1 commit into from
Jul 3, 2019

Conversation

xtuc
Copy link
Member

@xtuc xtuc commented Jul 2, 2019

targeting #215

@xtuc xtuc force-pushed the feat-add-kv_namespaces-bindings-js branch from 64808c5 to c505e36 Compare July 2, 2019 16:28
@xtuc xtuc requested a review from ashleymichal July 2, 2019 17:03
@xtuc
Copy link
Member Author

xtuc commented Jul 2, 2019

I would suggest to merge this PR into #215 and merge #215 as well. So we can do the bundle refactor (#293) more easily.

Cargo.toml Outdated
@@ -39,3 +39,4 @@ fs_extra = "1.1.0"

[features]
vendored-openssl = ['openssl/vendored']
slow_tests = []
Copy link
Contributor

@ashleymichal ashleymichal Jul 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for? just curious.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test for rust is very slow, so I wanted to exclude it when running locally. It's enabled in the CI.

use std::path::PathBuf;
use std::process::Command;

use crate::terminal::message;

fn write_kv_metadata(maybe_kv_namespaces: &Option<Vec<KvNamespace>>) -> Result<(), failure::Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any important difference between a None and a Vec<KvNamespace> of length 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that the vector is not present until you specify the key in the config. In the webpack backend I have a unwrap_or_else approach, feel free to indicate which one is prefered.

tests/build.rs Outdated

#[cfg(feature = "slow_tests")]
#[test]
fn it_builds_with_kv_metadata_rust() {
Copy link
Contributor

@ashleymichal ashleymichal Jul 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there also a test for it_builds_with_wasm_bindings_rust? because reading the code it looks like this may be a good regression test to have.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree, we don't yet.

@ashleymichal
Copy link
Contributor

ashleymichal commented Jul 2, 2019

the problem with this PR is that it puts metadata generation in the build step, however you will find metadata generation in the publish step; which means that in practice actually you will write kv namespace bindings and then write over them immediately and end up with just your wasm binding. I think we need to actually allow the multipart form data step to be its own thing; perhaps each project needs to be able to handle serializing itself.

@xtuc
Copy link
Member Author

xtuc commented Jul 3, 2019

however you will find metadata generation in the publish step

Metadata generation is back at build time #276.

and then write over them immediately and end up with just your wasm binding

Rust and JavaScript doesn't have metadata auto generation, this PR is introducing it for KV.

I think we need to actually allow the multipart form data step to be its own thing

I added a mention about the multipart from in #293. I don't know if it's related to this PR.

perhaps each project needs to be able to handle serializing itself.

This is currently the case but there no need to, that's why #280 was made.

@xtuc
Copy link
Member Author

xtuc commented Jul 3, 2019

TODO: keep the tests but remove the kv_namespace logic to merge

@xtuc xtuc changed the base branch from feat-add-kv_namespaces-bindings to feat-better-kv July 3, 2019 13:26
@xtuc xtuc changed the title feat: add kv_namespaces bindings for Rust and javascript [WIP] add some tests Jul 3, 2019
@xtuc xtuc force-pushed the feat-add-kv_namespaces-bindings-js branch 2 times, most recently from 9d5e6f5 to 939860d Compare July 3, 2019 13:48
@xtuc xtuc force-pushed the feat-add-kv_namespaces-bindings-js branch from 939860d to 9d4b5f1 Compare July 3, 2019 13:48
@xtuc xtuc changed the title [WIP] add some tests add some tests Jul 3, 2019
@xtuc
Copy link
Member Author

xtuc commented Jul 3, 2019

Only adds a test, merging in feat-better-kv now.

@xtuc xtuc merged commit 4be30a5 into feat-better-kv Jul 3, 2019
@xtuc xtuc deleted the feat-add-kv_namespaces-bindings-js branch July 3, 2019 13:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants