Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Comments

Merge cmd/gen-test-vectors and integration/client_tests.go#1194

Merged
gdbelvin merged 7 commits intogoogle:masterfrom
Zyqsempai:merge-cmd-and-integration-tests
Feb 13, 2019
Merged

Merge cmd/gen-test-vectors and integration/client_tests.go#1194
gdbelvin merged 7 commits intogoogle:masterfrom
Zyqsempai:merge-cmd-and-integration-tests

Conversation

@Zyqsempai
Copy link
Contributor

Merged cmd/gen-test-vectors and integration/client_tests.go
Changed generate command go test ../../impl/integration --generate
Added bool gnerate flag to impl/integration/main_test.go

I think we need also change the test command in TravisCI.

@Zyqsempai Zyqsempai requested a review from gdbelvin as a code owner February 7, 2019 19:29
@Zyqsempai Zyqsempai force-pushed the merge-cmd-and-integration-tests branch from db17077 to becda60 Compare February 7, 2019 19:31
@Zyqsempai
Copy link
Contributor Author

@gdbelvin Can't say that this is the best implementation. Coz all the tests are pretty messed up and also i wasn't able to test it because of docker mysql issue.

@codecov
Copy link

codecov bot commented Feb 7, 2019

Codecov Report

Merging #1194 into master will decrease coverage by 2.23%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1194      +/-   ##
==========================================
- Coverage   65.02%   62.78%   -2.24%     
==========================================
  Files          46       46              
  Lines        3342     3461     +119     
==========================================
  Hits         2173     2173              
- Misses        811      930     +119     
  Partials      358      358
Impacted Files Coverage Δ
core/integration/client_tests.go 60.62% <0%> (-24.05%) ⬇️
core/client/mutations.go 79.06% <0%> (-2.33%) ⬇️
core/keyserver/revisions.go 63.92% <0%> (-1.9%) ⬇️
impl/sql/directory/storage.go 67.66% <0%> (-1.51%) ⬇️
core/sequencer/server.go 74.76% <0%> (+1.86%) ⬆️
impl/sql/mutationstorage/mutations.go 73.68% <0%> (+5.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fd9e44...d86d12a. Read the comment docs.

}

// GenerateTestVectors verifies set/get semantics.
// TODO(gbelvin): Migrate into core/integration/client_tests to avoid code rot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving this! You can now delete this TODO

@@ -31,7 +31,6 @@ import (

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The separation of impl/integration from core/integration isn't documented, so let me explain here:
The layout of the code is designed to make using Key Transparency in an enterprise environment easy. Everything that might be implementation specific is in the impl directory. In order for the core directory to operate independently of implementation details, it must not have any references to impl. This is why the unit tests that rely only on the interfaces can remain in core, while the actual test that supplies the dependencies lives in impl.

Please keep impl/integration/env.go in impl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it there because of the cycle dependecies, so it cannot be solved without moving something, or env.go or all the tests to impl/integration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the cycle in particular?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd/gen-test-vectors has call to impl/integration
and impl/integration has call to integration/client_tests.go
if we merge cmd/gen-test-vectors into integration/client_tests.go we get cycle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the link between cmd/gen-test-vectors to impl/integration can be split:

  1. main() in cmd/gen-test-vectors is now impl/integration/main_test.go
  2. GenerateTestVectors used to depend on impl/integration/env.go, but this can be swapped with core/integration/env.go

There are a few other references to impl in GenerateTestVectors which I've annotated with fixes for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i'l try to do it in this way.

if err != nil {
t.Fatalf("Could not create Env: %v", err)
}
if *generate {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this configuration, GenerateTestVectors is it's own unit test and as such probably belongs outside the for loop, else we will generate the test vectors len(AllTests) times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but anyway we run NewEnv(ctx) for each loop cycle, maybe we should move it outside too?

Copy link
Contributor

@gdbelvin gdbelvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep impl/integration/env.go in place to maintain the invariant of no references to impl code inside of core

"github.com/google/keytransparency/core/testutil"

"github.com/golang/protobuf/jsonpb"
"github.com/google/martian/log"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this import be "log" or "glog"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest glog;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a pre existing issue. Fixed in #1197

desc: "empty_alice",
wantProfile: nil,
setProfile: []byte("alice-key1"),
ctx: authentication.WithOutgoingFakeAuth(ctx, "alice"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestEmptyGetAndUpdate uses the following to avoid an import reference to impl.

Suggested change
ctx: authentication.WithOutgoingFakeAuth(ctx, "alice"),
opts: env.CallOpts("alice"),

@Zyqsempai Zyqsempai force-pushed the merge-cmd-and-integration-tests branch from cf7f3ee to 8600e5c Compare February 8, 2019 15:53
@Zyqsempai
Copy link
Contributor Author

@gdbelvin Looks like done, but i have doubts, since i wasn't able to test it and i have strong feeling that i am confused a little bit;))

Copy link
Contributor

@gdbelvin gdbelvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks good, thanks!

@gdbelvin gdbelvin merged commit ff0e49d into google:master Feb 13, 2019
gdbelvin added a commit to gdbelvin/keytransparency that referenced this pull request Feb 13, 2019
* 'metric' of github.com:gdbelvin/keytransparency:
  Merge cmd/gen-test-vectors and integration/client_tests.go (google#1194)
gdbelvin added a commit to gdbelvin/keytransparency that referenced this pull request Feb 13, 2019
* 'metric' of github.com:gdbelvin/keytransparency:
  Merge cmd/gen-test-vectors and integration/client_tests.go (google#1194)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants