vincentbernat / serverspec-example Goto Github PK
View Code? Open in Web Editor NEWAdvanced use example of serverspec
Advanced use example of serverspec
Looks like it is unable to instantiate the reports file for some reason. I am using
ruby 1.9.3p484 and rspec 2.14.8
** Invoke reports:clean
** Execute check:server:all
** Execute spec
** Invoke reports:build (first_time)
** Invoke spec
** Execute reports:build
rake aborted!
Errno::EINVAL: Invalid argument - ./reports/spec--2015-07-07T17:53:07.json
c:/Users/ssonker/cookbooks-downloaded/serverspec-example/Rakefile:160:in initia lize' c:/Users/ssonker/cookbooks-downloaded/serverspec-example/Rakefile:160:in
open'
c:/Users/ssonker/cookbooks-downloaded/serverspec-example/Rakefile:160:in `block
(2 levels) in <top (required)>'
There is no license mentioned currently in the repo, which is of concern for proprietary use. Could you clarify the licensing terms?
The Link to http://angular-file-upload.appspot.com/js/angular-file-upload.js isn't valid anymore.
It seams there is a new Version and the old one is not maintained anymore.
I started work on changing the orientation of the report tables, as I have lots of tests and fewer hosts. So I wanted hosts along top and tests as rows.
Is this something easily done in angular (it's new to me!) or should I transform the report data first?
This is great work, thanks for sharing it.
I've had to run my own httpd server without using your builtin reports:view option. With that option it does run everything well except it will not list available reports on the http://localhost:5000/viewer/#/upload page. Maybe it's a recent webrick change or a permissions problem but for some reason below the "choose file" button there is nothing else.
Any tips?
Hello,
when loading the viewer in apache, or rubys http server all i get is a blank page.
Tested in chrome, firefox and safari on OSX.
Any ideas?
thanks
In viewer/scripts/report.js you use the tuple (role,spec,line number) for identifying a rule.
...
// Get example identifier (role, spec, line number)
var exampleIdentifier = function (e) {
var matches = e.file_path.match(/^\.\/spec\/([^\/]+)\/([^\/]+)_spec\.rb$/);
if (matches) {
return [ matches[1], matches[2], e.line_number ];
}
};
...
// We need to get a list of all tests in a topological order
// for the current roleset. A test is a role, a spec file and
// a line number.
var tests = _.map(input, function(r) {
// Keep only examples that match our roleset
var examples = _.filter(r.results.examples, function(e) {
return _.indexOf(rs, exampleRole(e)) != -1
});
return _.map(examples, exampleIdentifier);
});
...
The line number approach breaks down, when you create dynamic spec item in order to avoid redundancies by replacing handcoded specs with data-driven tests. Consider this example (illustrative artificial pseudocode)
hosts.each do |hostname|
describe host(hostname) do
it { should be_reachable.with( :port => 443 ) }
end
end
The line number of the check is always the same. As a consequence, only the first spec is reported in the viewer.
Suggestion for the solution: Why not use the id field of the json report for identification purposes?
It is already possible to use an "output formatter", like --format html, to product an HTML output report. Would it be possible to convert your angular JS report table into such an output format, to remove the need for a web server/viewer?
I imaging a Jenkins job using the HTML Publisher that would run:
rake -m -j 5 check:server:all
and the table would be the final report.
Not sure if I followed this correctly.....but my understanding was....if the roles are defined in Rakefile and the hostname meets that role requirement...only tests under that role folder would be executed for that host. Tests under othe role folders would be ignored.
However...in the following case, it appears the tests under conscs are executed for each host in the hosts file.
Rakefile modification for hosts
# Return all roles of a given host
def roles(host)
roles = [ "all" ]
case host
when /dmcs.+\-con/
roles << "conscs"
when /dmas.+\-con/
roles << "consas"
when /dmxpl.+\-con/
roles << "consxpl"
end
roles
end
hosts file
dmcs12q-con-08
dmcs11q-con-08
dmas11q-con-08
dmas12q-con-08
Execution output
$ bundle exec rake spec
DL is deprecated, please use Fiddle
user@dmcs12q-con-08's password:
[OK ] dmcs12q-con-08.
DL is deprecated, please use Fiddle
user@dmcs11q-con-08's password:
[OK ] dmcs11q-con-08
DL is deprecated, please use Fiddle
user@dmas11q-con-08's password:
[33 /37 ] dmas11q-con-08
DL is deprecated, please use Fiddle
user@dmas12q-con-08's password:
[33 /37 ] dmas12q-con-08
I tried running bundle exec rake check:role:conscs, but it fails after the second host as
$ bundle exec rake check:role:conscs
DL is deprecated, please use Fiddle
user@dmcs12q-con-08's password:
[OK ] dmcs12q-con-08
DL is deprecated, please use Fiddle
user@dmcs11q-con-08's password:
[OK ] dmcs11q-con-08
rake aborted!
Errno::EINVAL: Invalid argument @ rb_sysopen - ./reports/check:role:conscs--2015
-07-10T14-06-28.json
c:/Users/user/cookbooks/documentum-serverspec-scripts/Rakefile:167:in `initia
lize'
c:/Users/user/cookbooks/documentum-serverspec-scripts/Rakefile:167:in `open'
c:/Users/user/cookbooks/documentum-serverspec-scripts/Rakefile:167:in `block
(2 levels) in <top (required)>'
c:/Users/user/cookbooks/documentum-serverspec-scripts/Rakefile:210:in `block
in <top (required)>'
Tasks: TOP => reports:build
(See full trace by running task with --trace)
Is it possible that my regex is not evaluating all hosts in the rakefile in roles section?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.