Permalink
Browse files

fix(dockerode): fix stopping container

  • Loading branch information...
jkuri committed Sep 18, 2017
1 parent 9e549ab commit 5690e1da2d63ae2a4aaa3503557fa5467aaaa192
@@ -93,7 +93,7 @@ describe('Builds', () => {
}));
});

xit('should start new build (send push event)', () => {
it('should start new build (send push event)', () => {
return sendGitHubRequest(requestD3, pushEventHeader)
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
return cnt === 3;
@@ -123,7 +123,7 @@ describe('Builds', () => {
}));
});

xit('should restart last build and send same push event, the old build should stop', () => {
it('should restart last build and send same push event, the old build should stop', () => {
return Promise.resolve()
.then((): any => browser.wait(() => {
return element.all(by.css('.is-running')).count().then(count => count === 0);
@@ -156,7 +156,7 @@ describe('Builds', () => {
}));
});

xit('should restart last build', () => {
it('should restart last build', () => {
return Promise.resolve()
.then((): any => browser.wait(() => {
return element.all(by.css('.disabled')).count().then(cnt => cnt === 0);
@@ -154,7 +154,7 @@ describe('Build Details', () => {
});
});

xit('should start new build (D3) and see progress bar in second job run', () => {
it('should start new build (D3) and see progress bar in second job run', () => {
return Promise.resolve()
.then(() => browser.get('/'))
.then(() => sendGitHubRequest(requestD3, header))
@@ -217,7 +217,7 @@ describe('Build Details', () => {
});
});

xit(`should restart first build and see approximately time remaining`, () => {
it(`should restart first build and see approximately time remaining`, () => {
return browser.get('/build/1')
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
return cnt > 0;
@@ -7,9 +7,8 @@ chai.use(chaiAsPromised);
const expect = chai.expect;

describe('Job Details', () => {
let originalTimeout: number;
before(() => login().then(() => browser.waitForAngularEnabled(false)));
after(() => logout().then(() => browser.waitForAngularEnabled(true)));
before(() => login());
after(() => logout());

xit('should restart job watch console log until it matches expected output', () => {
return browser.get('/job/5')
@@ -14,7 +14,7 @@ exports.config = {
framework: 'mocha',
mochaOpts: {
reporter: 'spec',
timeout: 25000,
timeout: 45000,
slow: 3000,
colors: true,
bail: true
@@ -116,7 +116,9 @@ export function stopContainer(id: string): Observable<any> {
let container = null;
try {
container = docker.getContainer(id);
} catch (e) { }
} catch (e) {
observer.complete();
}

if (container) {
try {
@@ -155,11 +157,17 @@ export function killContainer(id: string): Promise<void> {
.then(containerInfo => {
if (containerInfo.State.Running) {
return container.kill();
} else {
return Promise.resolve(containerInfo.State.Status);
}
})
.then(status => {
if (status === 'exited') {
container.remove();
} else {
return Promise.resolve();
}
})
.then(() => container.remove())
.then(() => resolve())
.catch(err => {
if (err.statusCode === 404) {

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 5690e1d

Please sign in to comment.