azukiapp/azk

Azk running tests

Opened this issue · 6 comments

Well, azk is an awesome tool for devs!

When I trying use it, I have a little doubt, I don't know if you have an problem/idea like this, but is very useful if I can run my tests directly in AZK. maybe: azk start test or something like this.

What you think about it?
Thansk in advance!

We have planned a binStubs scheme.
e.g.:

  • Azkfile
aliases({
  bundle     : { command: ["bundle", "exec"]}, // system: azkdemo (default)
  scaffold   : { alias: "bundle", append: ["rails", "g", "scaffold"]},
  test       : { alias: "bundle", append: ["rake", "test"], tty: true, context: 'test'},
  'import-db': { system: "mysql", command: ["mysql"], depends: false}
});
  • Ways of running:
$ azk script generator --path ./script
  ./script/bundle
  ./script/scaffold
$ azk shell [system]
$ azk exec test
$ azk exec scaffold -- post title:string body:text
$ azk exec test -C dev -T
$ azk exec -- bundle
$ ./script/scaffold post title:string body:text

This feature was suggested by @willian a while ago.

This is a good idea. Think not just about tests, but any kind of task or command.

Currently I use Docker + Fabric to define some tasks. Some tasks are just docker exec -it ....

Azkfile.js could support something like this:

systems({
  'app': {
    image: { docker: "azukiapp/python:3.4" },
    // ...
    tasks: {
      createsuperuser: function(run) {
        run('python manage.py createsuperuser');
      },
      migrate: function(run) {
        run('python manage.py migrate');
      },
      hello: function(run, name) {
        run('echo Hello '+name);
      }
    }
  }
);

Allowing us to execute

$ azk task createsuperuser
$ azk task migrate
$ azk task hello:world

Each task would be just a function, with an argument (run function) that connect to container and execute the command passed. I think that this is more flexible and easier to reason about than another configuration section in a JSON-like way.

It doesn't matter if in the future the azk backend will be changed from docker to VM or something else, just the run function implementation will be changed (from docker exec/tty allocation to SSH, e.g.).

This is really interesting! Any idea when will it be released?

as yet not @VictorGama, there are some major priorities. But as soon as possible it will be done. I also like that she had already been implemented.

@gullitmiranda No problem. Will keep watching this issue until it is implemented. Thanks!