Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Docker containers not shutting down when closing GUI #521

Closed
secondl1ght opened this issue Dec 9, 2021 · 7 comments · Fixed by #844
Closed

Bug: Docker containers not shutting down when closing GUI #521

secondl1ght opened this issue Dec 9, 2021 · 7 comments · Fixed by #844
Labels
bug Something isn't working up for grabs Anyone can work on this

Comments

@secondl1ght
Copy link

Describe the bug
When exiting out of the application and then running docker ps it looks like the docker containers do not shut down and continue running after the GUI has been closed.

To Reproduce
Steps to reproduce the behavior:

  1. Run Polar and launch a network
  2. Close out of the GUI
  3. Check docker containers in terminal

Expected behavior
Docker containers get shutdown when GUI is closed.

Desktop (please complete the following information):

  • OS: PopOS
  • Polar Version: v1.3.0
  • Docker Version: 20.10.11
  • Docker Compose Version: 1.29.2

Additional context
If I have missed something please let me know.

@secondl1ght secondl1ght added the bug Something isn't working label Dec 9, 2021
@jamaljsr
Copy link
Owner

jamaljsr commented Dec 9, 2021

Thanks for the feedback. This has indeed been an annoyance to me every once in a while.

@jamaljsr jamaljsr added the up for grabs Anyone can work on this label Dec 19, 2023
@Abdulkbk
Copy link
Contributor

Abdulkbk commented Mar 2, 2024

I will work on this @jamaljsr

@jamaljsr
Copy link
Owner

jamaljsr commented Mar 2, 2024

Sounds good. Thank you!

@Abdulkbk
Copy link
Contributor

Abdulkbk commented Mar 7, 2024

HI @jamaljsr, I am having a blocker.

I worked on a solution for this issue but I noticed that the test failed.

My implementation involves leveraging electron's 'before-quit' when a user exits polar and sending a message to the renderer process from main process. Now the blocker I have is that I imported ipcRenderer from electron in a react component and I used it to listen to messages from the main process. This works fine during development but a test always fails.

I tried a couple of solutions I found online including adding a preload.js script and exposing ipcRenderer through contextBridge. None seems to be working.

So I would appreciate it if you could advise me on how I can access ipcRendrer or point me to resources. I think that would really help.

@jamaljsr
Copy link
Owner

jamaljsr commented Mar 8, 2024

Hey @Abdulkbk, have you tried mocking the ipcRenderer's methods using jest.fn()? I've done this before in the ipcService tests.

Another approach that may work is to use jest.mock('electron'); to mock the entire library, but this way requires filling in more of the exposed API.

Something like this:

jest.mock('electron', () => ({
  ipcRenderer: {
    on: jest.fn(),
    removeAllListeners: jest.fn(),
  },
}));

@Abdulkbk
Copy link
Contributor

Abdulkbk commented Mar 9, 2024

Hey @Abdulkbk, have you tried mocking the ipcRenderer's methods using jest.fn()? I've done this before in the ipcService tests.

Another approach that may work is to use jest.mock('electron'); to mock the entire library, but this way requires filling in more of the exposed API.

Something like this:

jest.mock('electron', () => ({
  ipcRenderer: {
    on: jest.fn(),
    removeAllListeners: jest.fn(),
  },
}));

Alright. I would mock ipcRenderer's method and see if the test will pass.

@Abdulkbk
Copy link
Contributor

I mocked ipcRenderer and it worked @jamaljsr.

I've submitted a PR. I'll wait for your review and feedback. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working up for grabs Anyone can work on this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants