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

Using RedisString::create(....) and running cargo test throws panicked at 'called Option::unwrap() on a None value #221

Open
danitseitlin opened this issue Feb 10, 2022 · 5 comments

Comments

@danitseitlin
Copy link

Hi,
I've upgraded my module to redismodule-rs 0.26.0.
When upgrading I had to make changes and use RedisString::create(...) function.
When I ran cargo build the build passed.
When I ran cargo test --features test --all --all-targets --verbose the following error appeared on each test that used RedisString:create(...):

---- get_sets_single stdout ----
thread 'get_sets_single' panicked at 'called `Option::unwrap()` on a `None` value', /home/danitseitlin/.cargo/registry/src/github.com-1ecc6299db9ec823/redis-module-0.26.0/src/redismodule.rs:107:60

Here is an example for the test:

#[test]
fn get_sets_single() {
    let ctx = Context::dummy().ctx;
    let args = vec![RedisString::create(ctx, "member1"), RedisString::create(ctx, "10"), RedisString::create(ctx, "20")];
    let sets = get_sets(args.into_iter());
    let sets = sets.expect("one member");
    assert_eq!(
        sets.0,
        vec![Set {
            member: "member1".to_string(),
            min_score: 10,
            max_score: 20,
        }]
    );
}

I hope you can help, thanks ✌🏽

@gkorland
Copy link
Contributor

@danitseitlin do you have such branch that you migrated to 0.26?

@oshadmi
Copy link
Contributor

oshadmi commented Feb 13, 2022

@danitseitlin Maybe init of redis module APIs is not done since redis-server is not launched?
See this example

@danitseitlin
Copy link
Author

@oshadmi The following tests are unit tests, would your suggestion still be relevant?

@danitseitlin
Copy link
Author

@gkorland Yes, here is the ongoing PR and the branch

@danitseitlin
Copy link
Author

@oshadmi @gkorland Hi, is there an progress with the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants