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

Write tests for the new router.ProcManager structure. #308

Open
6 tasks
evanlinjin opened this issue Apr 25, 2019 · 1 comment
Open
6 tasks

Write tests for the new router.ProcManager structure. #308

evanlinjin opened this issue Apr 25, 2019 · 1 comment
Assignees
Labels

Comments

@evanlinjin
Copy link

evanlinjin commented Apr 25, 2019

Branch: mainnet-dev

Prerequisites

  1. Move genMockApp() from test file of /pkg/app module to /pkg/app/apptest: https://github.com/skycoin/skywire/blob/64860b09f102a34d78b6eae80efcaa5d7c7cba66/pkg/app/executor_test.go#L29-L49

  2. Create an empty implementation of router.Router.

Tests

  • RunProc() should:

    • Fail if input c.BinLoc is invalid.
    • Succeed succeed if all other inputs are valid.
    • Not assign a port if input port=0.
    • After calling RunProc(), the returned *AppProc should:
      • Have ProcID() return 1 on first process, 2 in second, etc.
      • Have Stopped() return false.
      • After calling Stop(), should return no error and Stopped() should then return true.
  • Proc() should return the right *AppProc of given ProcID, and should return false if:

    • RunProc never returned such a ProcID.
    • AppProc is stopped.
  • AllocPort() should always return free ports.

  • ProcOfPort() should return proc assigned to given port only if proc is still running (not .Stopped()).

  • RangeProcIDs() and RangePorts() should cover all that is expected.

  • Close() should succeed.

@evanlinjin
Copy link
Author

evanlinjin commented Apr 29, 2019

@ivcosla I've started work on this. I finished implementing two tests and wrote barebones and comments for subsequent tests to be written.

Please refer to PR: #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

2 participants