You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Extensions/Ansible/Tests/Tasks/Ansible/_suite.ts
+43-42Lines changed: 43 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
importassert= require('assert');
2
2
importpath= require('path');
3
+
import{TestGuid}from'./mockAnsibleUtils';
3
4
4
5
varmocktest=require('vsts-task-lib/mock-test');
5
6
@@ -73,28 +74,28 @@ describe('Ansible Suite', function () {
73
74
}
74
75
});
75
76
76
-
// it('should run when inventory is inline content for remote machine', (done: MochaDone) => {
77
-
// this.timeout(1000);
78
-
// let testPath = path.join(__dirname, 'testInventoryToBeInlineForRemoteMachine');
79
-
// let runner = new mocktest.MockTestRunner(testPath);
80
-
// runner.run();
81
-
82
-
// try {
83
-
// assert(runner.succeeded, "Should have succeeded");
84
-
//assert(runner.stdOutContained('cmd run on remote machine = echo "DUMMY_IP_ADDRESS" > /tmp/inventory.ini'), 'should able to copy the inline content to inventory.ini file on remote machine');
85
-
//assert(runner.stdOutContained('cmd run on remote machine = chmod +x /tmp/inventory.ini'), 'should able to make the inventory.ini file as executable for dynamic inventory');
86
-
//assert(runner.stdOutContained('cmd run on remote machine = ansible-playbook -i /tmp/inventory.ini /path/to/ansiblePlaybookRoot/ansiblePlaybook.yml'), 'should able to run playbook on remote machine');
87
-
// assert(runner.stdOutContained('connection to dummy client established'), 'should able connect to client');
88
-
// assert(runner.stdOutContained('connection to dummy client terminated'), 'should able disconnect to client');
89
-
//assert(runner.stdOutContained('cmd run on remote machine = rm -f /tmp/inventory.ini', 'should clean all the temporary inventory file on remote machine'));
90
-
// done();
91
-
// }
92
-
// catch (error) {
93
-
// console.log("STDERR", runner.stderr);
94
-
// console.log("STDOUT", runner.stdout);
95
-
// done(error);
96
-
// }
97
-
// });
77
+
it('should run when inventory is inline content for remote machine',(done: MochaDone)=>{
assert(runner.stdOutContained(`cmd run on remote machine = echo "DUMMY_IP_ADDRESS" > /tmp/${TestGuid}inventory.ini`),'should able to copy the inline content to inventory.ini file on remote machine');
86
+
assert(runner.stdOutContained(`cmd run on remote machine = chmod +x /tmp/${TestGuid}inventory.ini`),'should able to make the inventory.ini file as executable for dynamic inventory');
87
+
assert(runner.stdOutContained(`cmd run on remote machine = ansible-playbook -i /tmp/${TestGuid}inventory.ini /path/to/ansiblePlaybookRoot/ansiblePlaybook.yml`),'should able to run playbook on remote machine');
88
+
assert(runner.stdOutContained('connection to dummy client established'),'should able connect to client');
89
+
assert(runner.stdOutContained('connection to dummy client terminated'),'should able disconnect to client');
90
+
assert(runner.stdOutContained(`cmd run on remote machine = rm -f /tmp/${TestGuid}inventory.ini`,'should clean all the temporary inventory file on remote machine'));
91
+
done();
92
+
}
93
+
catch(error){
94
+
console.log("STDERR",runner.stderr);
95
+
console.log("STDOUT",runner.stdout);
96
+
done(error);
97
+
}
98
+
});
98
99
99
100
it('should run when sudo and additional parameters is present for remote machine',(done: MochaDone)=>{
100
101
this.timeout(1000);
@@ -171,24 +172,24 @@ describe('Ansible Suite', function () {
171
172
}
172
173
});
173
174
174
-
// it('should run when inventory is inline content for agent machine', (done: MochaDone) => {
175
-
// this.timeout(1000);
176
-
// let testPath = path.join(__dirname, 'testInventoryToBeInlineForAgentMachine');
177
-
// let runner = new mocktest.MockTestRunner(testPath);
178
-
// runner.run();
179
-
180
-
// try {
181
-
// assert(runner.succeeded, "Should have succeeded");
182
-
//assert(runner.stdOutContained('cmd run on agent machine = echo "DUMMY_IP_ADDRESS" > /tmp/inventory.ini'), 'should able to copy the inline content to inventory.ini file on remote machine');
183
-
//assert(runner.stdOutContained('cmd run on agent machine = chmod +x /tmp/inventory.ini'), 'should able to make the inventory.ini file as executable for dynamic inventory');
184
-
//assert(runner.stdOutContained('cmd run on agent machine = ansible-playbook -i /tmp/inventory.ini /path/to/ansiblePlaybookRoot/ansiblePlaybook.yml'), 'should able to run playbook on remote machine');
185
-
//assert(runner.stdOutContained('cmd run on agent machine = rm -f /tmp/inventory.ini', 'should clean all the temporary inventory file on remote machine'));
186
-
// done();
187
-
// }
188
-
// catch (error) {
189
-
// console.log("STDERR", runner.stderr);
190
-
// console.log("STDOUT", runner.stdout);
191
-
// done(error);
192
-
// }
193
-
// });
175
+
it('should run when inventory is inline content for agent machine',(done: MochaDone)=>{
assert(runner.stdOutContained(`cmd run on agent machine = echo "DUMMY_IP_ADDRESS" > /tmp/${TestGuid}inventory.ini`),'should able to copy the inline content to inventory.ini file on remote machine');
184
+
assert(runner.stdOutContained(`cmd run on agent machine = chmod +x /tmp/${TestGuid}inventory.ini`),'should able to make the inventory.ini file as executable for dynamic inventory');
185
+
assert(runner.stdOutContained(`cmd run on agent machine = ansible-playbook -i /tmp/${TestGuid}inventory.ini /path/to/ansiblePlaybookRoot/ansiblePlaybook.yml`),'should able to run playbook on remote machine');
186
+
assert(runner.stdOutContained(`cmd run on agent machine = rm -f /tmp/${TestGuid}inventory.ini`,'should clean all the temporary inventory file on remote machine'));
0 commit comments