Skip to content

Commit f6b4d9a

Browse files
authored
Merge pull request #18 from oslabs-beta/dev-v7
Dev v7
2 parents 240752f + 4ad4f81 commit f6b4d9a

File tree

133 files changed

+13182
-3359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+13182
-3359
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ src/.store.js.icloud
1212
src/components/display/.RunningContainers.js.icloud
1313
src/components/display/.StoppedContainers.js.icloud
1414
src/database/docketeerdb
15+
server/database/docketeerdb
1516
.env
1617
yarn.lock
18+
coverage

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ Users have real-time access to the total amount of resources (CPU, memory usage)
141141
Within the Image and Docker Compose tab, you pull images from DockerHub by providing `repo:version` or uploading a `.yml` file.
142142

143143
### ➮ Process Logs
144-
You are now able to view logs for both running and stopped containers. You can filter logs by specifying the number of logs that you wish to receive (tail) as well as time (since). Process logs will help you analyze and debug problems faster by offering insights into what went wrong.
145-
![alt text](assets/processlogs.gif)
144+
View process logs from any number of running or stopped containers. The table is both exportable and sortable by any parameter. You can filter logs by specifying the number of logs that you wish to receive (tail) as well as time (since). Process logs will help you analyze and debug problems faster by offering insights into what went wrong.
145+
<!-- replace this gif
146+
-->
147+
![alt text](assets/docketeer-process-logs.gif)
146148

147149
<br> For a full demo of Docketeer's features, visit [docketeer.org](https://www.docketeer.org/demo).
148150

@@ -172,6 +174,11 @@ npm run test
172174
Read our [contributing guide](https://github.com/open-source-labs/Docketeer/blob/master/CONTRIBUTING.md) for more information on how to purpose bugfixes and improvements to Docketeer.
173175

174176
### Authors
177+
- Abigail Gerig [@4estgirl] (https://github.com/4estgirl) | [Linkedin] (https://www.linkedin.com/in/abigail-gerig/)
178+
- Trine Medina [@TrineMedina] (https://github.com/TrineMedina) | [Linkedin] (https://www.linkedin.com/in/trinemedina/)
179+
- Christian Looff [@cmlooff] (https://github.com/cmlooff) | [LinkedIn] (https://www.linkedin.com/in/christian-looff/)
180+
- Reuel Warner-Rosen [@Ruliwr] (https://github.com/Ruliwr) | [Linkedin] (https://www.linkedin.com/in/Ruliwr/)
181+
- Matt Dias [@Schmang13] (https://github.com/Schmang13) | [Linkedin] (https://www.linkedin.com/in/matthew-j-dias/)
175182
- Christina Son [@cson17](https://github.com/cson17) | [Linkedin](https://www.linkedin.com/in/christinason17/)
176183
- Fernando Luna [@lunaf-github](https://github.com/lunaf-github) | [Linkedin](https://www.linkedin.com/in/fernando-luna)
177184
- Austin Andrews [@austinandrews](https://github.com/austinandrews) | [Linkedin](https://www.linkedin.com/in/austinandrews17/)

__tests__/ContainersTab.test.js

Lines changed: 139 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,150 @@
1-
import React from "react";
2-
import { configure, shallow } from "enzyme"; // enzyme
3-
import Adapter from "enzyme-adapter-react-16"; // enzyme
4-
5-
import Containers from "../src/components/tabs/Containers";
6-
7-
configure({ adapter: new Adapter() }); // enzyme
8-
9-
function shallowSetup() {
10-
const props = {
11-
runningList: [
12-
{
13-
block: "0B/0B",
14-
ID: "a802306eeac3",
15-
CPUPerc: "0.17%",
16-
MemPerc: "0.11%",
17-
MemUsage: "2.195MiB/1.944GiB",
18-
Name: "blissful_matsumoto",
19-
NetIO: "796B/0B",
20-
PIDs: "5",
21-
},
22-
],
23-
stoppedList: [
24-
{
25-
Name: "zealous",
26-
ID: "c902ec744095",
27-
Img: "84c5f6e03bf0",
28-
Created: "2 days ago",
29-
name: "zealous_pare",
30-
},
31-
],
32-
};
33-
const enzymeWrapper = shallow(<Containers {...props} />);
34-
35-
return {
36-
props,
37-
enzymeWrapper,
38-
};
39-
}
40-
41-
describe("Running containers are being rendered", () => {
42-
const { enzymeWrapper } = shallowSetup();
43-
it("Should render <div> tag that has class renderContainers in Running", () => {
44-
expect(enzymeWrapper.type()).toEqual("div");
45-
expect(enzymeWrapper.hasClass("renderContainers")).toEqual(true);
1+
import React, { Component } from 'react';
2+
import Containers from '../src/components/tabs/Containers';
3+
4+
// Started to migrate to React-Testing-Library...
5+
import { create } from 'react-test-renderer';
6+
import { fireEvent, render, screen } from '@testing-library/react';
7+
import * as actions from '@testing-library/jest-dom';
8+
9+
const props = {
10+
runningList: [
11+
{
12+
block: '0B/0B',
13+
ID: 'a802306eeac3',
14+
CPUPerc: '0.17%',
15+
MemPerc: '0.11%',
16+
MemUsage: '2.195MiB/1.944GiB',
17+
Name: 'blissful_matsumoto',
18+
NetIO: '796B/0B',
19+
PIDs: '5'
20+
}
21+
],
22+
stoppedList: [
23+
{
24+
Names: 'zealous',
25+
ID: 'c902ec744095',
26+
Img: '84c5f6e03bf0',
27+
Created: '2 days ago',
28+
name: 'zealous_pare'
29+
}
30+
]
31+
};
32+
/** Docketeer 7.0
33+
* This was the previous groups code, we left commented just incase it became useful down the road.
34+
*/
35+
36+
// Debug test
37+
// describe('Containers', () => {
38+
// test('Renders the Container Component', () => {
39+
// render(<Containers {...props} />);
40+
// // Screening the component
41+
// screen.debug();
42+
// });
43+
// });
44+
45+
// function shallowSetup() {
46+
// const props = {
47+
// runningList: [
48+
// {
49+
// block: '0B/0B',
50+
// ID: 'a802306eeac3',
51+
// CPUPerc: '0.17%',
52+
// MemPerc: '0.11%',
53+
// MemUsage: '2.195MiB/1.944GiB',
54+
// Name: 'blissful_matsumoto',
55+
// NetIO: '796B/0B',
56+
// PIDs: '5'
57+
// }
58+
// ],
59+
// stoppedList: [
60+
// {
61+
// Name: 'zealous',
62+
// ID: 'c902ec744095',
63+
// Img: '84c5f6e03bf0',
64+
// Created: '2 days ago',
65+
// name: 'zealous_pare'
66+
// }
67+
// ]
68+
// };
69+
// const reactWrapper = create(<Containers {...props} />);
70+
71+
// return {
72+
// props,
73+
// reactWrapper
74+
// };
75+
// }
76+
77+
describe('Running containers are being rendered', () => {
78+
test('Should render <div> tag that has title renderContainers in Running', () => {
79+
// Testing for if there is a container with the title of renderContainer
80+
render(<Containers {...props} />);
81+
82+
const renderContainer = screen.getByTitle('renderContainers');
83+
expect(renderContainer).toHaveClass('renderContainers');
4684
});
4785

48-
it("Should render the correct number of containers", () => {
49-
expect(enzymeWrapper.find(".containers").children().length).toEqual(1);
50-
expect(enzymeWrapper.find(".stopped-containers").children().length).toEqual(
51-
1
52-
);
86+
test('Should render the correct number of containers', () => {
87+
const { container } = render(<Containers {...props} />);
88+
const containers = container.getElementsByClassName('containers');
89+
expect(containers.length).toBe(1);
5390
});
5491
});
5592

56-
describe("It should render the exited containers", () => {
57-
const { enzymeWrapper } = shallowSetup();
58-
it("Should render <div> tag in Stopped", () => {
59-
expect(enzymeWrapper.type()).toEqual("div");
60-
});
93+
describe('It should render the exited containers', () => {
94+
test('Should have a className run-btn in Stopped component', () => {
95+
render(<Containers {...props} />);
6196

62-
it("Should have className run-btn in Stopped component", () => {
63-
expect(
64-
enzymeWrapper.find(".stopped-button").props().children[0].props.className
65-
).toEqual("run-btn");
66-
});
97+
const runBtnRender = screen.getByTestId('run-btn');
6798

68-
it("ClassName run-btn in Stopped component have onClick function", () => {
69-
expect(
70-
enzymeWrapper.find(".stopped-button").props().children[0].props.onClick
71-
).toBeDefined();
99+
expect(runBtnRender).toHaveClass('run-btn');
72100
});
73101

74-
it("Should have className stop-btn in Stopped component", () => {
75-
expect(
76-
enzymeWrapper.find(".stopped-button").props().children[1].props.className
77-
).toEqual("stop-btn");
78-
});
102+
/** Docketeer 7.0
103+
* These are all preliminary tests that were not veted out. Could be useful as a starting point.
104+
*/
79105

80-
it("ClassName stop-btn in Stopped component have onClick function", () => {
81-
expect(
82-
enzymeWrapper.find(".stopped-button").props().children[1].props.onClick
83-
).toBeDefined();
84-
});
106+
//! NEED TO FIGURE OUT HOW TO ADD ONCLICK TEST
107+
// test('ClassName run-btn in stopped component have onClick function', () => {
108+
// const handleOnClick = jest.fn();
109+
110+
// render(<Containers {...props} runStopped={handleOnClick} />);
111+
112+
// const runBtnRender = screen.queryByText('RUN');
113+
// // screen.queryByText('RUN');
114+
115+
// fireEvent.click(runBtnRender);
116+
117+
// expect(runBtnRender).toHaveBeenCalledTimes(1);
118+
// });
85119
});
120+
121+
// describe('It should render the exited containers', () => {
122+
// const { reactWrapper } = shallowSetup();
123+
//! test('Should render <div> tag in Stopped', () => {
124+
//! expect(reactWrapper.type()).toEqual('div');
125+
//! });
126+
127+
//* test('Should have className run-btn in Stopped component', () => {
128+
//* expect(
129+
//* reactWrapper.find('.stopped-button').props().children[0].props.className
130+
//* ).toEqual('run-btn');
131+
//* });
132+
133+
// test('ClassName run-btn in Stopped component have onClick function', () => {
134+
// expect(
135+
// reactWrapper.find('.stopped-button').props().children[0].props.onClick
136+
// ).toBeDefined();
137+
// });
138+
139+
// test('Should have className stop-btn in Stopped component', () => {
140+
// expect(
141+
// reactWrapper.find('.stopped-button').props().children[1].props.className
142+
// ).toEqual('stop-btn');
143+
// });
144+
145+
// test('ClassName stop-btn in Stopped component have onClick function', () => {
146+
// expect(
147+
// reactWrapper.find('.stopped-button').props().children[1].props.onClick
148+
// ).toBeDefined();
149+
// });
150+
// });

__tests__/ImageTab.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/** Docketeer 7.0
2+
* These tests do not work as enzyme is highly depricated and does not communicate with React 18
3+
*/
4+
15
import React from "react";
26
import { configure, shallow } from "enzyme";
37
import Adapter from "enzyme-adapter-react-16";

__tests__/ListReducer.test.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
import containerListReducer from '../src/reducers/containerListReducer'; // import containerList reducer
2-
import imageListReducer from '../src/reducers/imageListReducer'; // import imageListReducer reducer
1+
/** Docketeer 7.0
2+
* These tests do not, might be an issue with the word export.
3+
*/
4+
5+
import containerListReducer from '../src/redux/reducers/containerListReducer'; // import containerList reducer
6+
import imageListReducer from '../src/redux/reducers/imageListReducer'; // import imageListReducer reducer
37

48

59
describe("Dockeeter reducer", () => {
@@ -32,7 +36,7 @@ describe("Dockeeter reducer", () => {
3236
payload: [{ cid: "789" }],
3337
};
3438
expect(containerListReducer(state, action).runningList.length).toEqual(1);
35-
expect(containerListReducer(state, action).runningList[0].cid).toEqual("789");
39+
expect(containerListReducer(state, action).runningList[0].ID).toEqual("789");
3640
});
3741
});
3842

@@ -49,7 +53,7 @@ describe("Dockeeter reducer", () => {
4953
payload: [{ cid: "789" }],
5054
};
5155
expect(containerListReducer(state, action).stoppedList.length).toEqual(1);
52-
expect(containerListReducer(state, action).stoppedList[0].cid).toEqual("789");
56+
expect(containerListReducer(state, action).stoppedList[0].ID).toEqual("789");
5357
});
5458
});
5559

@@ -73,7 +77,7 @@ describe("Dockeeter reducer", () => {
7377
stoppedList: [{ cid: "123" }, { cid: "456" }],
7478
};
7579
const action = { type: "REMOVE_CONTAINER", payload: "123" };
76-
expect(containerListReducer(newState, action).stoppedList[0].cid).toEqual("456");
80+
expect(containerListReducer(newState, action).stoppedList[0].ID).toEqual("456");
7781
});
7882
});
7983

@@ -85,7 +89,7 @@ describe("Dockeeter reducer", () => {
8589
};
8690
const action = { type: "STOP_RUNNING_CONTAINER", payload: "123" };
8791
newState = containerListReducer(newState, action);
88-
expect(newState.runningList[0].cid).toEqual("456");
92+
expect(newState.runningList[0].ID).toEqual("456");
8993
});
9094
});
9195

@@ -96,7 +100,7 @@ describe("Dockeeter reducer", () => {
96100
stoppedList: [{ cid: "123" }, { cid: "456" }],
97101
};
98102
const action = { type: "RUN_STOPPED_CONTAINER", payload: "123" };
99-
expect(containerListReducer(newState, action).stoppedList[0].cid).toEqual("456");
103+
expect(containerListReducer(newState, action).stoppedList[0].ID).toEqual("456");
100104
});
101105
});
102106

__tests__/MetricsTab.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/** Docketeer 7.0
2+
* These tests do not work as enzyme is highly depricated and does not communicate with React 18
3+
*/
4+
15
import React from 'react';
26
import { configure, shallow } from 'enzyme';
37
import Adapter from 'enzyme-adapter-react-16';

__tests__/ProcessLogHelper.test.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,21 @@ describe('makeArrayOfObjects', () => {
2828

2929
expect(output).toEqual(true);
3030
});
31-
31+
//We edited the makeArrayOfObjects function and now this fails, not sure why as there still is a key of logMsg and timeStamp
3232
it('each object in returned array has timeStamp and logMsg properties', () => {
3333
const processLog = 'this_is_the_first_timestampZ this is the first log message\nthere is no second time stamp but there is a second log message';
3434
const result = makeArrayOfObjects(processLog);
3535

3636
let output = false;
3737

3838
if(result.every((element) =>
39-
element.timeStamp && element.logMsg
39+
element.timeStamp && element.logMsg && element.containerName
4040
)){
4141
output = true;
4242
}
4343

4444
expect(output).toEqual(true);
4545
});
46-
47-
it('log lines without timestamp will have "----" as value of timestamp property, otherwise the value will be timestamp', () => {
48-
const processLog = 'this_is_the_first_timestampZ this is the first log message\nthere is no second time stamp but there is a second log message\n \n ';
49-
const result = makeArrayOfObjects(processLog);
50-
51-
expect(result[0].timeStamp).toEqual('this_is_the_first_timestampZ');
52-
expect(result[0].logMsg).toEqual('this is the first log message');
53-
expect(result[1].timeStamp).toEqual('----');
54-
expect(result[1].logMsg).toEqual('there is no second time stamp but there is a second log message');
55-
});
56-
57-
it('when passed empty string, should return {timeStamp: \'\', logMsg: \'\'}', () => {
58-
59-
const result = makeArrayOfObjects('');
60-
61-
expect(result[0].timeStamp).toEqual('');
62-
expect(result[0].logMsg).toEqual('');
63-
});
6446
});
6547

6648
describe('buildOptionsObj', () => {

__tests__/README.Test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Because of the migration of our new dependencies, the original tests no longer work with Reacat 18. We were in the process of migrating away from enzyme but did not have time to fully implement. Would be a great task to pick up for the next iteration team.

0 commit comments

Comments
 (0)