Giter Club home page Giter Club logo

Comments (12)

petroav avatar petroav commented on May 22, 2024 1

I'd like to contribute to this effort. Just opened libp2p/go-libp2p-loggables#21 to kick things off. Anything I should keep in mind while writing tests? Special mocking frameworks you use or general guidelines I should follow?

I'll start with the utilities/miscellaneous repos as they're generally less intimidating and I'll open issues in the respective repos if I have questions.

from go-libp2p.

Stebalien avatar Stebalien commented on May 22, 2024 1

We generally just use the standard go testing library without any additional testing frameworks. The best way to learn how we write tests is to look at the tests in go-libp2p-swarm, go-libp2p-kad-dht, and go-libp2p-transport.

from go-libp2p.

zjiekai avatar zjiekai commented on May 22, 2024

Hi, I'm trying to run test.

In the code package imports are prefixed with github.com/libp2p/go-libp2p. Why not github.com/libp2p/go-libp2p? What am I missing?

Here is what I am referring to https://github.com/libp2p/go-libp2p/blob/master/p2p/discovery/mdns.go#L18

from go-libp2p.

zjiekai avatar zjiekai commented on May 22, 2024

There seems to be both github.com/ipfs/go-libp2p and github.com/libp2p/go-libp2p?

from go-libp2p.

whyrusleeping avatar whyrusleeping commented on May 22, 2024

We're in the middle of moving the libp2p code from the ipfs org to the new
libp2p org. Each package has to be moved manually and updated, we just
haven't gotten around to it yet. This doesn't currently cause any problems
for the code

On Wed, Aug 17, 2016, 07:10 zjiekai [email protected] wrote:

There seems to be both github.com/ipfs/go-libp2p and
github.com/libp2p/go-libp2p?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#83 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABL4HOJphZ6Y9VCeQsru3r960x9SwvB-ks5qgxZngaJpZM4JgUOS
.

from go-libp2p.

zjiekai avatar zjiekai commented on May 22, 2024

It's probably my lack of experience with golang getting me really confused.

Should I wait for the transition settled? Or should I just make a copy and edit the code in $GOPATH/src/github.com/libp2p/go-libp2p? Or are there some magic that make the go command work? I'd really like to learn the trick to run the code if that's not too much trouble.

There will be a a talk about IPFS in devcon in China. I'm trying to get started so if I get a chance to meet the IPFS guys I can ask some meaningful questions

update: I see. I should run go get github.com/libp2p/go-libp2p in the first place.

from go-libp2p.

whyrusleeping avatar whyrusleeping commented on May 22, 2024

@zjiekai did you get it working? If you provide me with the error messages of things going wrong I can be more helpful

from go-libp2p.

whyrusleeping avatar whyrusleeping commented on May 22, 2024

@zjiekai also, an aside, i'm super excited for DEVCON 2 :)

from go-libp2p.

whyrusleeping avatar whyrusleeping commented on May 22, 2024

To run the tests for go-libp2p, i would do the following:

First, get the code and deps:

go get -d github.com/libp2p/go-libp2p
cd $GOPATH/src/github.com/libp2p/go-libp2p
make deps
gx-go rewrite

Now, you're set to run the tests, to run all of them, do:

go test ./...

To run tests for a specific package, do:

go test ./p2p/net/swarm

You can add -v for more verbose information, and -cover for code coverage information:

go test -v -cover ./...
go test -v -cover ./p2p/net/mock

you can also generate html coverage reports by doing:

go test -v -coverprofile=cover.out ./p2p/net/swarm
go tool cover -html=cover.out

Then, before you commit anything, make sure to undo all the import path changes:

gx-go rewrite --undo

Let me know if i missed anything!

from go-libp2p.

zjiekai avatar zjiekai commented on May 22, 2024

@whyrusleeping It's working now. Thank you for the detailed write up. Super helpful!

from go-libp2p.

whyrusleeping avatar whyrusleeping commented on May 22, 2024

@zjiekai awesome! Please let me know if you run into any other issues or have any questions

from go-libp2p.

Stebalien avatar Stebalien commented on May 22, 2024

This issue hasn't really helped motivate us to improve test coverage, although test coverage has been steadily getting better. So I'm going to close it.

from go-libp2p.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.