Commit Graph

34 Commits

Author SHA1 Message Date
Nikola Divic
ae49729afb test: chain sethead cli command
Also moved the mock definition to a separate file (mocks_test.go)
because it's gonna be used in other test files, and it didn't make sense
for it to stay inside chain_test.go.
2022-02-09 20:46:51 +01:00
Nikola Divic
811bc62d65 test: cli test setup & test chain head
CLI actions lack unit tests. I decided to use the approach similar to
what I found in `send_test.go` using gomock, but I don't rely on custom
"service" implementations but mock the whole FullNode API.
This first commit validates the test setup by testing the simplest method
of the chain category, e.g. `chain head`.

This requires a minor refactor of the CLI action code:
- The constructor (`GetFullNodeAPI`) checks if there's an injected mock
API in the app Metadata and uses that in unit tests.
- Actions shouldn't use raw `fmt.*` but instead write to the `app.Writer`
so the CLI output is testable
2022-02-08 17:15:45 +01:00
Anton Evangelatov
adcb8f3b15 improve get api error messages 2021-08-16 14:33:08 +03:00
ZenGround0
73a644f320 Review response 2021-08-12 13:09:43 -04:00
ZenGround0
3bb5d4eb8f Strict major minor version checking on v0 and v1 apis 2021-08-11 16:40:14 -04:00
Anton Evangelatov
fa7e52dbda add explicit error msg if repo dir does not exist 2021-08-01 00:22:55 -04:00
Raúl Kripalani
8433aae1af use fallback api infos last; init service with markets-path. 2021-07-29 16:10:04 +01:00
Raúl Kripalani
b17fcfc4d1 bugfix. 2021-07-29 14:36:04 +01:00
Raúl Kripalani
3144da86f3 add RepoType#String; adjust repo parsing logic. 2021-07-29 13:49:51 +01:00
Raúl Kripalani
90427bc3af fix docs, add flag. 2021-07-29 13:39:03 +01:00
Raúl Kripalani
8fae68a5ae fix tests. 2021-07-29 13:21:55 +01:00
Raúl Kripalani
3b2c3a3f6b polish. 2021-07-29 12:56:08 +01:00
Raúl Kripalani
22c0884f5f target markets API for markets commands. 2021-07-29 12:37:29 +01:00
Raúl Kripalani
4e19d8d562 support MARKETS_API_INFO env var; support markets-repo, markets-api-url flags. 2021-07-29 10:55:37 +01:00
Raúl Kripalani
b04fb75a92 rename flag to very verbose. 2021-07-27 20:49:30 +01:00
Raúl Kripalani
48cddd3644 add a super verbose -vv flag to lotus and lotus-miner. 2021-07-27 14:25:28 +01:00
Łukasz Magiera
49e26cce7d api: Separate the Net interface from Common 2021-07-15 11:41:30 +02:00
Peter Rabbitson
6efd2e7335 Handle the --color flag via proper global state
Use `color.NoColor` as a global progressively modified as one descends
down command flags. Allows non-surprising operation when --color is
accepted at multiple layers, and even makes this behave predictably:

    lotus-miner --color actor control list --color=false
2021-07-13 12:22:29 +02:00
Peter Rabbitson
4dd59b566c Respect GOLOG_LOG_FMT=color 2021-07-08 10:44:37 +02:00
Peter Rabbitson
c7bb326c78 Enable color by default only if os.Stdout is a TTY 2021-07-07 18:12:24 +02:00
Łukasz Magiera
508e2d5c49 gateway: Fix api getter 2021-04-20 18:42:12 +02:00
Łukasz Magiera
cf96ad4fdb fix lint 2021-04-06 14:30:49 +02:00
Łukasz Magiera
e8f28d7b9f Fix tests 2021-04-06 12:24:58 +02:00
Łukasz Magiera
d8bff4d19f Make gateway work with v1 api 2021-04-05 13:47:10 +02:00
Łukasz Magiera
64bf5b382b cliutil: cast full api to the v0 interface 2021-04-02 13:20:31 +02:00
Łukasz Magiera
3cac23b4a7 cli: get raw full api correctly 2021-04-02 13:07:56 +02:00
Łukasz Magiera
ba49c6206e cli: Default to v0 api for now 2021-04-01 14:17:22 +02:00
Łukasz Magiera
e003977559 apiclient: Version client funcs 2021-03-25 15:39:48 +01:00
Łukasz Magiera
65dcec0ebc api client: Use versioned api packages 2021-03-23 19:15:53 +01:00
Łukasz Magiera
c41777dcd2
API proxy struct codegen (#5854)
* mostly working api proxy gen

* api: Consistent api names

* fix docsgen

* regenerate api struct

* api: expand external interfaces

* Add missing gen files

* apigen: fix perm detection

* api: Move perm tags to the interface

* gofmt

* worker perms

* docsgen

* docsgen: ignore tag comments

* apigen: add codegen warning

* gofmt

* missing actor type

* docsgen

* make linter happy

* fix lint

* apigen: use directives for tags

* docsgen

* regen openrpc docs
2021-03-23 13:42:56 +01:00
Łukasz Magiera
58e49e3259 Move api client builders to a cliutil package 2021-03-05 21:08:41 +01:00
Łukasz Magiera
b060569fe9
Revert "Add support for /https, /http, /wss API multiaddresses." 2020-10-14 19:55:36 +02:00
Hector Sanjuan
c6ed6a0d65 Add support for /https, /http, /wss API multiaddresses.
Lotus API endpoint are by default expressed as multiaddresses (i.e. lotus auth
api-info) which end in /http, although they can be provided as standard URLs too.

There is an inconsistency here because despite the "http" part, Lotus will use "ws" protocol.

This lets lotus default to "ws" but honor whatever the user puts in the multiaddress (i.e.
/dns4/my.lotus.node/tcp/443/https) would work now using https, where before it uses "ws".
2020-10-14 14:58:58 +02:00
Łukasz Magiera
6cc7559b04 Fix APIInfo import cycle in tests 2020-10-09 02:58:12 +02:00