Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/10107#discussion_r46695798
--- Diff:
core/src/test/scala/org/apache/spark/status/api/v1/AllStagesResourceSuite.scala
---
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.status.api.v1
+
+import org.scalatest.Matchers
+import org.apache.spark.SparkFunSuite
+import org.apache.spark.scheduler.StageInfo
+import org.apache.spark.ui.jobs.UIData.StageUIData
+
+class AllStagesResourceSuite extends SparkFunSuite with Matchers {
+
+ test("test test") {
+ val s = "abc"
+ assert(s === "abc")
+ }
+
+ test("test class instantiation") {
+ val status = StageStatus.COMPLETE
+ val stageInfo = new StageInfo(
+ 1, 1, "stage 1", 10, Seq.empty, Seq.empty, "details abc", Seq.empty)
+ val stageUiData = new StageUIData()
+ val includeDetails = false
+
+ val actual = AllStagesResource.stageUiToStageData(
+ status, stageInfo, stageUiData, includeDetails)
+ val expected = new StageData(status, 1, 1, 0, 0, 0, 0, None, None,
None,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "stage 1", "details abc", "",
Seq.empty, None, None)
+
+ assert(actual.status == expected.status)
--- End diff --
Hi @keypointt thanks for doing this, but I guess I was thinking something
much simpler, sorry for the extra work you had to do. I was thinking a test
case which really just focuses on `firstTaskLaunchTime` -- so call
`AllStagesResource.stageUiToStageData` as you are doing, but just check the
`firstTaskLaunchTime` part of the results. And try it with 3 different
versions:
1. No tasks --> `firstTaskLaunchTime == None`
2. Several tasks, but none launched --> `firstTaskLaunchTime == None`
3. Several tasks, some launched --> `firstTaskLaunchTime == Some(...)`
does that make sense? I dont' see much value in checking every single
field since that is mostly covered by the other tests. Then I'd also rename
the test to "firstTaskLaunchTime" as well so its clear that is what its
focusing on.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]