Merge "update tosca parser verification feature"
[sdc.git] / sdc-os-chef / sdc-sanity / chef-repo / cookbooks / sdc-sanity / recipes / setup_sanity.rb
1 tests_path = "/tmp/sdc-tests/"
2 ci_test_suite = "sanity.xml"
3
4
5 bash "extract asdc-tests" do
6    code <<-EOH
7         [ ! -d /tmp/sdc-tests/ ] && mkdir -p /tmp/sdc-tests
8         cd /tmp/sdc-tests
9         rm -rf *
10         /bin/tar -xf /root/chef-solo/cookbooks/sdc-sanity/files/default/asdc-tests.tar --strip-components=1 -C /tmp/sdc-tests
11         chmod -R 755 /tmp/sdc-tests
12    EOH
13 end
14
15
16 template "sdc-yaml-config" do
17     path "/tmp/sdc-tests/conf/sdc.yaml"
18     source "sdc-sanity.yaml.erb"
19     owner "root"
20     group "root"
21     mode "0755"
22     variables ({
23         :target_path                  => "#{tests_path}/target",
24         :catalogBE_ip                 => node['Nodes']['BE'],
25         :catalogBE_port               => node['BE'][:http_port],
26         :webportal_ip                 => node['Nodes']['FE'],
27         :webportal_port               => node['FE'][:http_port],
28         :titan_file                   => "/tmp/sdc-tests/conf/titan.properties",
29         :tests_path_ci                => "#{tests_path}/CI/tests",
30         :components_path              => "#{tests_path}/CI/components",
31         :importResourceConfigDir      => "#{tests_path}/CI/importResource",
32         :importTypesDir               => "#{tests_path}/CI/importTypesTest",
33         :importResourceTestsConfigDir => "#{tests_path}/CI/importResourceTests",
34         :ConfigurationFile            => "#{tests_path}/conf/configuration.yaml",
35         :errorConfigurationFile       => "#{tests_path}/conf/error-configuration.yaml",
36         :CASSANDRA_IP                 => node['Nodes']['CS'],
37         :CASSANDRA_PWD                => node['cassandra'][:cassandra_password],
38         :CASSANDRA_USR                => node['cassandra'][:cassandra_user]
39     })
40 end
41
42
43 replication_factor=1
44 template "titan.properties" do
45     path "/tmp/sdc-tests/conf/titan.properties"
46     source "BE-titan.properties.erb"
47     owner "root"
48     group "root"
49     mode "0755"
50     variables({
51         :CASSANDRA_IP => node['Nodes']['CS'],
52         :CASSANDRA_PWD => node['cassandra'][:cassandra_password],
53         :CASSANDRA_USR => node['cassandra'][:cassandra_user],
54         :DC_NAME => "DC-"+node.chef_environment,
55             :rep_factor => replication_factor    
56     })
57 end
58
59
60 bash "run asdc ci sanity tests" do
61     cwd "#{tests_path}"
62     code <<-EOH
63         jar_file=`ls asdc-tests-*-jar-with-dependencies.jar`
64         ./startTest.sh $jar_file #{ci_test_suite}
65         echo "return code from startTest.sh = [$?]"
66     EOH
67     timeout 72000
68 end