-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add integration tests #274
Conversation
How I ran the tests:
|
f2e6ca2
to
9dfec73
Compare
add secret as env variable in github workflow remove env from docker compose
2eae7f7
to
de8c133
Compare
mount file and pass env remove extra env temp cat temp empty printf rearrange validate json workaround cleanup verbose
de8c133
to
fcffd97
Compare
This reverts commit b797bdf.
54c5ea6
to
0abc22c
Compare
Fix coverage report coverage fix
0abc22c
to
6b4d818
Compare
wantErr: fmt.Errorf("could not read ledgers: End sequence number is less than start (50 < 100)"), | ||
}, | ||
{ | ||
name: "start too large", | ||
args: []string{"export_ledgers", "-s", "4294967295", "-e", "4294967295"}, | ||
golden: "", | ||
wantErr: fmt.Errorf("could not read ledgers: Latest sequence number is less than start sequence number (%d < 4294967295)", latestLedger), | ||
}, | ||
{ | ||
name: "end too large", | ||
args: []string{"export_ledgers", "-e", "4294967295", "-l", "4294967295"}, | ||
golden: "", | ||
wantErr: fmt.Errorf("could not read ledgers: Latest sequence number is less than end sequence number (%d < 4294967295)", latestLedger), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are flaky test. Therefore I removed them
idxOfOutputArg := indexOf(test.args, "-o") | ||
var testOutput []byte | ||
var outLocation string | ||
var stat os.FileInfo | ||
if idxOfOutputArg > -1 { | ||
outLocation = test.args[idxOfOutputArg+1] | ||
_, err = os.Stat(outLocation) | ||
if err != nil { | ||
// Check if the error is due to the file not existing | ||
if !os.IsNotExist(err) { | ||
assert.NoError(t, err) | ||
} | ||
} else { | ||
err = deleteLocalFiles(outLocation) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to delete anything in the output directory before exporting any data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
I have a couple questions for my own understanding before approving. I also glanced over the golden set files briefly, but i'm assuming they are valid since the integration tests succeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we'll run into any issues using different ledger ranges to generate these files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. There can be issues if code has bug for different kind of input. Since the ledger range can contain only certain variety of data. It may not cover for all test cases.
I had a thought to have custom fixtures along with ledger range test cases. But I think that's already part of our unit tests. so we should be good generally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good enough start point and if we run into edge cases, we can always either adjust the ledger ranges or add custom fixtures as you suggested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Checklist
PR Structure
otherwise).
Thoroughness
Release planning
semver, and I've changed the name of the BRANCH to release/_ , feature/_ or patch/* .
What
This PR adds integration tests for all the
export_*
commands. The changes comprise of following:runCLITest
incmd/export_ledgers_test.go
is used to run all test files in cmd.CREDS_TEST_HUBBLE
is added to this repo which has access to bigquery and storage bucket. This is used by integration test to read ledger backend dataWhy
To gain confidence in feature addition or bug fix, integration tests are required.
Known limitations
None
Test Results: