Skip to content

Exception when getting a connection in many unit tests #10

@trezker

Description

@trezker

I'm having an issue with unittesting as the mongo connections cause an exception. Minimal test program provided. Is there a way to get around this or is it a problem with mondo?

I have tried this without the static pool thing as well as without using pool and getting connection directly with Mongo(...), same error.

core.exception.InvalidMemoryOperationError@src/core/exception.d(693): Invalid memory operation

import mondo;

class MongoAlloc {
static:
private MongoPool pool;
public Mongo GetConnection() {
if(!pool)
pool = new MongoPool("mongodb://localhost");
return pool.pop;
}
}

unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}
unittest {
Mongo mongo = MongoAlloc.GetConnection();
}

void main()
{
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions