Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test docs_blog_2021_08_31_seeding_databases_tutorial_dot_md failing on commit 66afaf446bc3a1c4d0338d71662fdff8c6801e4b #309

Open
juniorbassani opened this issue Feb 19, 2022 · 0 comments · May be fixed by #312
Labels
bug Something isn't working

Comments

@juniorbassani
Copy link
Contributor

Describe the bug
Testing Synth fails on test docs_blog_2021_08_31_seeding_databases_tutorial_dot_md.

To Reproduce

  • run RUST_BACKTRACE=1 cargo t docs_blog_2021_08_31_seeding_databases_tutorial_dot_md on the top-level Synth directory.
  1. See error
running 1 test
test docs_blog_2021_08_31_seeding_databases_tutorial_dot_md ... FAILED

failures:

---- docs_blog_2021_08_31_seeding_databases_tutorial_dot_md stdout ----
/home/junior/dev/rust/synth/synth/tmp/docs/blog/2021-08-31-seeding-databases-tutorial:224 has a JSON only code block that will be skipped
thread 'docs_blog_2021_08_31_seeding_databases_tutorial_dot_md' panicked at 'Unable to open the namespace "docs/blog/2021-08-31-seeding-databases-tutorial"

Caused by:
    0: at file docs/blog/2021-08-31-seeding-databases-tutorial/735.json
    1: Failed to parse collection
    2: expected `,` or `}` at line 4 column 38

Stack backtrace:
   0: <E as anyhow::context::ext::StdError>::ext_context
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.43/src/context.rs:27:29
   1: anyhow::context::<impl anyhow::Context<T,E> for core::result::Result<T,E>>::context::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.43/src/context.rs:50:30
   2: core::result::Result<T,E>::map_err
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/result.rs:853:27
   3: anyhow::context::<impl anyhow::Context<T,E> for core::result::Result<T,E>>::context
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.43/src/context.rs:50:9
   4: synth::cli::store::Underlying::parse
             at /home/junior/dev/rust/synth/synth/src/cli/store.rs:25:9
   5: synth::cli::store::Store::get_collection
             at /home/junior/dev/rust/synth/synth/src/cli/store.rs:146:26
   6: synth::cli::store::Store::get_ns
             at /home/junior/dev/rust/synth/synth/src/cli/store.rs:81:54
   7: synth::cli::Cli::generate
             at /home/junior/dev/rust/synth/synth/src/cli/mod.rs:170:29
   8: synth::cli::Cli::run::{{closure}}
             at /home/junior/dev/rust/synth/synth/src/cli/mod.rs:85:36
   9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  10: docs::helpers::run::{{closure}}
             at /home/junior/dev/rust/synth/synth/tests/helpers/mod.rs:29:9
  11: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  12: docs::helpers::generate_scenario::{{closure}}
             at /home/junior/dev/rust/synth/synth/tests/helpers/mod.rs:10:5
  13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  14: docs::helpers::generate::{{closure}}
             at /home/junior/dev/rust/synth/synth/tests/helpers/mod.rs:6:5
  15: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  16: docs::docs_blog_2021_08_31_seeding_databases_tutorial_dot_md::{{closure}}
             at /home/junior/dev/rust/synth/synth/tests/docs.rs:56:18
  17: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  18: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:199:17
  19: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:60:13
  20: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
  21: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
  22: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:55:9
  23: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:197:13
  24: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:526:33
  25: async_executor::Executor::run::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:242:9
  26: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  27: async_executor::LocalExecutor::run::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:447:9
  28: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  29: async_io::driver::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-io-1.6.0/src/driver.rs:142:33
  30: async_global_executor::reactor::block_on::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:3:18
  31: async_global_executor::reactor::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:12:5
  32: async_global_executor::executor::block_on::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:36
  33: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
  34: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
  35: async_global_executor::executor::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:5
  36: async_std::task::builder::Builder::blocking::{{closure}}::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:171:25
  37: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:60:13
  38: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
  39: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
  40: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:55:9
  41: async_std::task::builder::Builder::blocking::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:168:17
  42: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
  43: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
  44: async_std::task::builder::Builder::blocking
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:161:9
  45: async_std::task::block_on::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/block_on.rs:33:5
  46: docs::docs_blog_2021_08_31_seeding_databases_tutorial_dot_md
             at /home/junior/dev/rust/synth/synth/tests/docs.rs:22:1
  47: docs::docs_blog_2021_08_31_seeding_databases_tutorial_dot_md::{{closure}}
             at /home/junior/dev/rust/synth/synth/tests/docs.rs:22:1
  48: core::ops::function::FnOnce::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/ops/function.rs:227:5
  49: core::ops::function::FnOnce::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/ops/function.rs:227:5
  50: test::__rust_begin_short_backtrace
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/test/src/lib.rs:578:5
  51: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/alloc/src/boxed.rs:1636:9
  52: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/panic/unwind_safe.rs:271:9
  53: std::panicking::try::do_call
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/panicking.rs:403:40
  54: std::panicking::try
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/panicking.rs:367:19
  55: std::panic::catch_unwind
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/panic.rs:133:14
  56: test::run_test_in_process
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/test/src/lib.rs:601:18
  57: test::run_test::run_test_inner::{{closure}}
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/test/src/lib.rs:493:39
  58: test::run_test::run_test_inner::{{closure}}
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/test/src/lib.rs:520:37
  59: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/sys_common/backtrace.rs:125:18
  60: std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/mod.rs:481:17
  61: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/panic/unwind_safe.rs:271:9
  62: std::panicking::try::do_call
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/panicking.rs:403:40
  63: std::panicking::try
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/panicking.rs:367:19
  64: std::panic::catch_unwind
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/panic.rs:133:14
  65: std::thread::Builder::spawn_unchecked::{{closure}}
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/mod.rs:480:30
  66: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/ops/function.rs:227:5
  67: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/alloc/src/boxed.rs:1636:9
  68: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/alloc/src/boxed.rs:1636:9
  69: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/sys/unix/thread.rs:106:17
  70: start_thread
             at /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477:8
  71: clone
should contain one of the following errors: {
    "unknown variant `date_time`",
}', synth/tests/docs.rs:75:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/panicking.rs:103:14
   2: docs::docs_blog_2021_08_31_seeding_databases_tutorial_dot_md::{{closure}}
             at /home/junior/dev/rust/synth/synth/tests/docs.rs:75:9
   3: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
   4: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:199:17
   5: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:60:13
   6: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
   7: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
   8: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:55:9
   9: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:197:13
  10: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:526:33
  11: async_executor::Executor::run::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:242:9
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  13: async_executor::LocalExecutor::run::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:447:9
  14: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/future/mod.rs:80:19
  15: async_io::driver::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-io-1.6.0/src/driver.rs:142:33
  16: async_global_executor::reactor::block_on::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:3:18
  17: async_global_executor::reactor::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:12:5
  18: async_global_executor::executor::block_on::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:36
  19: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
  20: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
  21: async_global_executor::executor::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:5
  22: async_std::task::builder::Builder::blocking::{{closure}}::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:171:25
  23: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:60:13
  24: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
  25: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
  26: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:55:9
  27: async_std::task::builder::Builder::blocking::{{closure}}
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:168:17
  28: std::thread::local::LocalKey<T>::try_with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:399:16
  29: std::thread::local::LocalKey<T>::with
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/std/src/thread/local.rs:375:9
  30: async_std::task::builder::Builder::blocking
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:161:9
  31: async_std::task::block_on::block_on
             at /home/junior/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/block_on.rs:33:5
  32: docs::docs_blog_2021_08_31_seeding_databases_tutorial_dot_md
             at /home/junior/dev/rust/synth/synth/tests/docs.rs:22:1
  33: docs::docs_blog_2021_08_31_seeding_databases_tutorial_dot_md::{{closure}}
             at /home/junior/dev/rust/synth/synth/tests/docs.rs:22:1
  34: core::ops::function::FnOnce::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/ops/function.rs:227:5
  35: core::ops::function::FnOnce::call_once
             at /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    docs_blog_2021_08_31_seeding_databases_tutorial_dot_md

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 48 filtered out; finished in 1.03s

error: test failed, to rerun pass '-p synth --test docs'

Expected behavior
The test should pass.

Environment (please complete the following information):

  • OS: Linux (Ubuntu)
  • Version: 5.11.0-40-generic (Ubuntu 20.04)

Additional context
From what I can tell, the problem is likely on the function write_code_block that writes a synth schema to a file for testing purposes. The file synth/tmp/docs/blog/2021-08-31-seeding-databases-tutorial/735.json is generated from the test suite with the following contents, which is probably causing the error:

{
            "type": "array",
            "length": 1,
            "content":     "authorId": "@User.content.id"
}
@juniorbassani juniorbassani added the bug Something isn't working label Feb 19, 2022
@chesedo chesedo linked a pull request Feb 28, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant