Git Product home page Git Product logo

Comments (6)

trentmwillis avatar trentmwillis commented on May 19, 2024 1

Again:

process.env.PARTITION is not provided or controller by this addon. It would be set as an environment variable for the process

This means that yes, you must set it in your environment.

If you're hoping to use this with the --parallel option then it won't work properly since the config/environment is only generated once per build, meaning that partition numbers will not be available within that module. Splitting is done at run time, so unless you're only running a single partition (as in the example you gave above), it isn't possible to know the partition at build time.

Your only real option for doing this at run time is to check the query parameters.

from ember-exam.

trentmwillis avatar trentmwillis commented on May 19, 2024

So a couple things:

  1. process.env.PARTITION is not provided or controller by this addon. It would be set as an environment variable for the process if you do something like: PARTITION=2 ember exam. (I might need to clarify that in the README).
  2. I'd be very wary of why you need this in your acceptance tests (or any test for that matter) as one of the major benefits of splitting/randomizing tests is that your tests don't know the order/context in which they are running so that you have better guarantees of their autonomy.

from ember-exam.

Sinled avatar Sinled commented on May 19, 2024

I'd be very wary of why you need this in your acceptance tests

i know it sounds strange, but our acceptance tests works with real backend, and at the beginning of every acceptance test we need to 'login' test user, but login works in such way - when you login in one place, backend terminates other session, and parallel tests fail because of that.

so if there would be information about partitions it would be possible to use different test logins for different partitions.

Maybe i am doing something wrong and there is better solution for my problem?

from ember-exam.

trentmwillis avatar trentmwillis commented on May 19, 2024

Seems reasonable. As long as you're not directly supplying the tests with the partition number, then I think it makes sense. I would likely do something like:

// config/environment.js

var USERS = [
  // user login information
];

module.exports = function() {
  var partition = process.env.PARTITION;
  return {
    testUser: USERS[partition]
  };
};

from ember-exam.

Sinled avatar Sinled commented on May 19, 2024

@trentmwillis thanks for reply
i tried almost exact solution, but it is not working out of the box,
if i don't pass manually PARTITION variable, process.env.PARTITION is undefined in config file

But to manually specify PARTITION i need to run separate processes, with ugly looking command

PARTITION=1 ember exam --split 4 --partition 1 --server --query="hidepassed=true&nojscs=true&nolint=true" &
 PARTITION=2 ember exam --split 4 --partition 2 --server --query="hidepassed=true&nojscs=true&nolint=true" &
 PARTITION=3 ember exam --split 4 --partition 3 --server --query="hidepassed=true&nojscs=true&nolint=true" &
 PARTITION=4 ember exam --split 4 --partition 4 --server --query="hidepassed=true&nojscs=true&nolint=true"

am i right?

from ember-exam.

Sinled avatar Sinled commented on May 19, 2024

Your only real option for doing this at run time is to check the query parameters.

Thanks, i'll try this way.

from ember-exam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.