-
Notifications
You must be signed in to change notification settings - Fork 513
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
Move test code in respective projects #5330
Conversation
acc8175
to
a7e31e4
Compare
572a8e2
to
94e96b8
Compare
4bac200
to
3c8f12c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5330 +/- ##
==========================================
- Coverage 62.69% 61.37% -1.32%
==========================================
Files 301 302 +1
Lines 10848 10818 -30
Branches 773 786 +13
==========================================
- Hits 6801 6640 -161
- Misses 4047 4178 +131 ☔ View full report in Codecov by Sentry. |
}, { | ||
"type": "record", | ||
"name": "TestRecord", | ||
"namespace": "com.spotify.scio.avro", | ||
"doc": "Record for testing", | ||
"fields": [ | ||
{"name": "int_field", "type": ["null", "int"], "default": null}, | ||
{"name": "long_field", "type": ["null", "long"], "default": null}, | ||
{"name": "float_field", "type": ["null", "float"], "default": null}, | ||
{"name": "double_field", "type": ["null", "double"], "default": null}, | ||
{"name": "boolean_field", "type": ["null", "boolean"], "default": null}, | ||
{"name": "string_field", "type": ["null", "string"], "default": null}, | ||
{"name": "array_field", "type": {"type": "array", "items": "string"}, "default": null} | ||
] |
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 one stayed in scio-core/test
to test kryo for avro
def getInput: String | ||
def setInput(input: String): Unit | ||
def getTestInput: String | ||
def setTestInput(input: String): Unit | ||
@Required | ||
def getOutput: String | ||
def setOutput(output: String): Unit |
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.
Since PipelineOptions
are dynamically loaded, Some tests were failing because the --input
and --output
parameters were transformed into options instead of staying in the args. Renamed the values to avoid conflicts wit other tests
@@ -38,7 +39,7 @@ object AvroUtils { | |||
.array() | |||
.items() | |||
.stringType() | |||
.noDefault() | |||
.arrayDefault(Collections.emptyList()) |
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.
to match with the specific record
// additional kryo registrar for avro schema null value | ||
// deserializes null to the singleton instance for schema equality | ||
@KryoRegistrar | ||
class TestKryoRegistrar extends IKryoRegistrar { | ||
|
||
override def apply(k: Kryo): Unit = | ||
k.forClass[NullNode](new SingletonSerializer(NullNode.getInstance())) | ||
} |
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.
Apparently, this test suite was not run before.
This registrar is needed for the set so schema equality passes. Without this, kryo creates a new NullNode
instance failing equality checks
@@ -65,8 +80,7 @@ class KryoAtomicCoderTest extends PipelineSpec { | |||
Pair("record", 10) kryoCoderShould roundtrip() | |||
} | |||
|
|||
// Enable once https://github.com/scala/scala/pull/10425 is release |
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.
fix is now live
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 amazing! thanks for your hard work doing this refactor
libraryDependencies ++= Seq( | ||
"com.google.api.grpc" % "proto-google-cloud-bigtable-v2" % googleCloudProtoBigTableVersion, | ||
"com.google.http-client" % "google-http-client" % googleHttpClientVersion, | ||
"com.google.http-client" % "google-http-client" % googleHttpClientVersion, // TODO should we have this here ? |
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.
Possible to move to google-cloud-platform
test module?
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 required by the Pretty
module. Instead of using toString
in the scio SCollection matchers, we rely on this with custom formatting for
- avro
- gson
Ideally we should use smth like the cat's Show
typeclass so any etension can give its formatting. Kept as is to avoid breaking the test API.
scio-avro/src/test/scala/com/spotify/scio/avro/AvroJobTestTest.scala
Outdated
Show resolved
Hide resolved
val schema: Schema = AvroUtils.schema | ||
implicit def coder: Coder[GenericRecord] = avroGenericRecordCoder(schema) | ||
|
||
"AvroTap" should "support saveAsAvroFile with SpecificRecord" in withTempDir { dir => |
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.
Wdyt about moving the withTempDir
functionality into scio-test-core
? It seems to have a lot of usage both within Scio and within many pipeline projects. (doesn't have to be in this PR!)
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.
Will expose this in a separate PR
Should we retarget this for 0.15? |
I think @clairemcginty wanted this to ship some test helpers sooner. |
I can actually try to run mima on |
Was thinking more for the ease of merging 0.15 later, but if there is an urgent need we can get it out sooner and just deal with the merge issues. |
This is the result of the binary compatibility check
which is expected because moved to |
Splitting
scio-test
in sub modulesscio-test-core
: depending onscio-core
+ some avro deps for pretty printingscio-test-google-cloud-platform
: depending onscio-test-core
+ GCP depsscio-test-parquet
: for future helpersIn order to use
scio-test-core
inscio-core/test
scope, I created a symlink to thecom.spotify.scio.testing
package.As most scio module test scope require test data, set the dependency on
scio-core % "test->test"
to get access to test helpers fromscio-test-core