file-plugins: enabling messagepack format#142
Conversation
Codecov Report
@@ Coverage Diff @@
## master #142 +/- ##
==========================================
+ Coverage 67.66% 71.31% +3.65%
==========================================
Files 32 37 +5
Lines 1976 2761 +785
==========================================
+ Hits 1337 1969 +632
- Misses 570 690 +120
- Partials 69 102 +33
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
conduit/plugins/importers/filereader/test_resources/conduit_data/conduit.yml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
These test fixtures were generated using the block generator scenario config.allmixed.small.yml
winder
left a comment
There was a problem hiding this comment.
The actual feature looks fine, nice improvement. I have some misc questions and comments about the refactoring and some potential dead code.
conduit/pipeline/pipeline.go
Outdated
| } | ||
|
|
||
| // makeConfig creates a plugin config from a name and config pair. | ||
| // configWithLogger creates a plugin config from a name and config pair. |
There was a problem hiding this comment.
why rename this? Seems unrelated to the rest of the PR
There was a problem hiding this comment.
In order to set up the integration test, I wanted to break-out the pure config generating portion to a new method pluginType.GetConfig(). With this refactoring, it's clearer that this method does 2 things:
- sets up the plugin's config
- returns a logger that inherits the pipeline's logger setup
These seemed sufficiently unrelated to me that I thought it was worth rename.
However, renaming is not at all crucial.
| @@ -0,0 +1,72 @@ | |||
| # Log verbosity: PANIC, FATAL, ERROR, WARN, INFO, DEBUG, TRACE | |||
| log-level: INFO | |||
There was a problem hiding this comment.
I'd consider making this programmatically, or removing as much as possible so that there's less opportunity for things to become stale.
| // the genesis file is available __in addition to__ the round 0 block file. | ||
| // This is because the encoding assumed for the genesis is different | ||
| // from the encoding assumed for blocks. | ||
| // TODO: handle the case of a multipurpose file that contains both encodings. |
There was a problem hiding this comment.
Could you elaborate on this TODO in the comment? As it is, I'm not sure exactly what you have in mind.
Also, the canonical genesis file is json. Maybe we should always write it that way?
There was a problem hiding this comment.
What I mean in the TODO is that in principle, it's possible to have a block 0 which includes both the genesis information as well as the block information. But you hint that this may not be such a great idea and we should probably just assume we have a genesis.json since that's canonical. Does it actually make sense to have a round 0? Should we eliminate the concept?
There was a problem hiding this comment.
Plan:
- remove TODO
- file exporter/importer ASSUME genesis.json
- continue with block 0 in appropriate encoding
conduit/plugins/metadata.go
Outdated
| ) | ||
|
|
||
| // GetConfig creates an appropriate plugin config for the type. | ||
| func (pt PluginType) GetConfig(cfg data.NameConfigPair, dataDir string) (PluginConfig, error) { |
There was a problem hiding this comment.
What is this for? I'm having a hard time figuring out where it's used. There are already several patterns for creating test configurations in the other plugin tests, I think it would be better to use/refine one of those rather than adding a new scheme.
There was a problem hiding this comment.
I'm only using it in fileReadWrite_test.go, and also in the recently renamed pipelineImpl.configWithLogger(). I can easily recreate the logic in the test and revert this new function. I'll go ahead and do that, but I'm going to keep the added typing in this file to the constants Exporter, Processor and Importer as I believe that was the original intent.
There was a problem hiding this comment.
Thanks, yes please revert this and add a test helper if necessary. I think this is unique to the filereader/filewriter e2e test, so it probably doesn't need to be a generally available utility.
…from fileReadWrite_test.go
Co-authored-by: shiqizng <80276844+shiqizng@users.noreply.github.com>
| genesis := initProvider.GetGenesis() | ||
| genesisPath := path.Join(exp.cfg.BlocksDir, GenesisFilename) |
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
File Plugins: Add Messagepack Format and Default to
msgp.gzBased on the extension of the file pattern provided in a
file_readerorfile_writerplugin, choose:.msgpor.json).gz)When no pattern is provided, it defaults to
*.msgp.gzTest Plan
This is all tested in CI including a new integration test
conduit/plugins/importers/filereader/fileReadWrite_test.go