Comments (11)
Agreed. Unit tests should be independent, and finish rapidly.
The distinction is made clearly by Martin Fowler, between Sociable Tests and Solitary Tests.
https://martinfowler.com/bliki/UnitTest.html
(referencing Jay Fields, who originated these terms in https://leanpub.com/wewut)
We want only Solitary Tests to run from go test
.
from go-lachesis.
@rishflab I have tested on my machine (macOS Mojave) and it worked. To test client its mandatory to run server first. So what we can do is running server within client test other than depending on server test, in same way in server test have to add client test stuffs.
from go-lachesis.
Yeh we should make this sort of test an integration test.
I don't think the websocket server is currently being used anywhere in the codebase. I removed it along with many other unused transports and everything seems to be running. I don't think it should be in master unless it is being used in master. It is unneccesary cognitive overhead and maintenance burden.
If it is part of an incomplete feature it should probably sit in that feature branch until it is complete, imo.
from go-lachesis.
client_websocket_test.go hangs when trying to connect
if err := c.Connect(addr, path); err != nil { t.Error(err) return }
If I have the server_websocket_test.go running before running the client test, both tests are able to establish a connection and send messages to each other but both test processes gets stuck in CLOSE_WAIT after completing the test.
@s4kibs4mi could you shed some light on how these tests are meant to run?
from go-lachesis.
@rishflab to test client addr
parameter you are passing is the address of websocket server and the server must be up and running to test client. In test case 10 messages exchange happens between server and client and both go off.
from go-lachesis.
Hey thanks for you response.
The tests pass when i run the server test and the client tests sequentially but the processes still hang. Gracefulshutdown doesn’t seem to work on my machine, does it work on yours? (I’m running Ubuntu 18.04)
Also we are setting up CI/CD and these tests won’t work there as must run in a specific order which cannot be guaranteed.
from go-lachesis.
Uh, if the client needs the server to be or if some order is required, then this is not a unit test any more (which is what go test
assumes).
Is there a way we can mock the server? If not, maybe we can move this test out of the unit test chain and make some kind of integration test?
from go-lachesis.
@rishflab the purpose of test was to clarify the usage. And so far I can remember @andrecronje told me that it will be used to send events within nodes. Not sure if we are still on the track or decided something else to use.
from go-lachesis.
Yeh im curious myself, because i think gRPC is being used now for internode communication, not 100% sure.
from go-lachesis.
Hi, plz leave comments to help understand or resolve the issue.
@s4kibs4mi which issue does those new files belong to?
Agree with @AgustinCB. The tests need to be rewritten. In general, every test should not depend on any other tests.
from go-lachesis.
I will rewrite the tests.
@quan8 @andrecronje can clarify.
from go-lachesis.
Related Issues (20)
- P2P communication failure for new Lachesis nodes HOT 5
- Wrong delegation numbers (?) HOT 1
- Deployment of smart contracts to Opera testnet fails with Truffle error "unknown account" HOT 2
- Trying to run a private testnet manually. Crashing when reaching block in MaxEpochBlocks or cannot change epochs. HOT 5
- Dependabot can't parse your go.mod
- Some questions about the mainnet FTM HOT 1
- failed RPC connection to node1 HOT 2
- Error: No such object: node1 HOT 1
- Syncing stuck at block 614958 HOT 4
- lachesis --your-favourite-flags dumpconfig can not work HOT 2
- can not find other validators HOT 5
- How can I increase the number of block packaging transactions? HOT 1
- How can I increase the number of block packaging transactions?
- Modified the parameter block package transaction of Lachesis.Emitter.EmitIntervals to decrease
- is there fast syncmode to sync data, it is very hard to catchup HOT 1
- codahale/hdrhistogram repo url has been transferred under the github HdrHstogram umbrella
- Lost Fonda HOT 1
- FetchError: request to https://rpc.testnet.fantom.network/ failed, reason: Client network socket disconnected before secure TLS connection was established
- Node out of sync HOT 2
- read-only go-opera node HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-lachesis.