This repository was archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.pl
77 lines (64 loc) · 2.12 KB
/
setup.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#-------------------------------------------------------------------------
# setup.pl -
#
# Perform setup steps needed by the test suite. Clears out state that
# might interfere with the tests and installs the plugin to test.
#-------------------------------------------------------------------------
use strict;
use ElectricCommander;
$|=1;
# win/lin matches the chronic3 procedure platform property
$::gPlatform = "lin";
if ($^O eq "MSWin32") {
$::gPlatform = "win";
}
my $cmdrServer = $::ARGV[0];
my $outtop = $::ARGV[1];
my $plugin_ver = $::ENV{PLUGIN_VERSION};
my $plugin_name = $::ENV{PLUGIN_NAME};
my $plugin_key = $plugin_name;
$plugin_key =~ s/-[^-]+$//g;
$::ENV{PLUGIN_KEY} = $plugin_key;
my $N = new ElectricCommander($cmdrServer);
$N->abortOnError(0);
# the resource to test on is created in the "Master-OneVMProvision" step
# the formula for the name must agree in both places
$::gJobId = $::ENV{COMMANDER_JOBID};
print "==========SYSTEM TEST SETUP============\n";
print "pluginArtifacts: $::ENV{PLUGINS_ARTIFACTS}\n";
print "outtop : $outtop\n";
print "server : $cmdrServer\n";
print "key : $plugin_key\n";
print "ver : $plugin_ver\n";
print "name : $plugin_name\n";
print "platform : $::gPlatform\n";
print "\n";
$N->login('admin','changeme');
## re-install dependencies to make sure state is clean
## install this plugin
print "Uninstalling $plugin_key\n";
$N->uninstallPlugin($plugin_name);
my $msg = $N->getError();
if ($msg ne "") {
print "Error uninstalling plugin $plugin_name.\n";
print $msg;
exit 1;
}
print "Installing $::ENV{PLUGINS_ARTIFACTS}/$plugin_key/$plugin_key.jar\n";
my $xpath = $N->installPlugin("$::ENV{PLUGINS_ARTIFACTS}/$plugin_key/$plugin_key.jar");
$msg = $N->getError();
if ($msg ne "") {
print "Error installing plugin $plugin_name.\n";
print $msg;
exit 1;
}
$plugin_name = $xpath->findvalue('//plugin/pluginName')->value;
$N->promotePlugin("$plugin_name");
$msg = $N->getError();
if ($msg ne "") {
print "Error promoting plugin $plugin_name.\n";
print $msg;
exit 1;
}
print "Done with setup\n";
exit 0;