You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "mdedetrich (via GitHub)" <gi...@apache.org> on 2024/09/09 07:20:20 UTC
[PR] Add overridden duration timeout to StreamTestKit [pekko]
mdedetrich opened a new pull request, #1468:
URL: https://github.com/apache/pekko/pull/1468
The context of this change is https://github.com/apache/pekko-http/pull/590#pullrequestreview-2281514043. It turns out its extremely cumbersome to manually override the duration so I am adding this public method
@raboof @jrudolph Let me know if this line of thinking is on the right lines.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "raboof (via GitHub)" <gi...@apache.org>.
raboof commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1921036375
##########
stream-testkit/src/main/mima-filters/1.1.1.backwards.excludes/pr-1468-override-timeout-stream-testkit.backwards.excludes:
##########
@@ -0,0 +1 @@
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.testkit.scaladsl.StreamTestKit.assertNoChildren")
Review Comment:
When adding mima excludes, please add the reason why it is acceptable. In this case, the reason might be we don't promise binary compatiblity for -testkit artifacts (https://pekko.apache.org/docs/pekko/current/common/binary-compatibility-rules.html), and that this method is `private[testkit]`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1749990316
##########
stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala:
##########
Review Comment:
Not sure if this is the best way to configure the timeout for scalatest, looking to see if there are more idiomatic ways.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #1468:
URL: https://github.com/apache/pekko/pull/1468#issuecomment-2338117065
including in 1.1.2 milestone - if 1.1.1-RC1 vote fails, we can consider adding this to a 1.1.1-RC2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1750089328
##########
stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala:
##########
@@ -27,10 +26,26 @@ import pekko.testkit.{ PekkoSpec, TestProbe }
import pekko.testkit.TestKitUtils
import org.scalatest.Failed
+import org.scalatest.time.{ Millis, Span }
import com.typesafe.config.{ Config, ConfigFactory }
+import java.util.concurrent.TimeUnit
+
abstract class StreamSpec(_system: ActorSystem) extends PekkoSpec(_system) {
+
+ final case class StreamConfig(allStagesStoppedTimeout: Span = Span({
Review Comment:
This might look a bit un-orthodox by Pekko standards, but it is the idiomatic way to override a configuration when in ScalaTest (which is what `StreamSpec` extends).
The defaault behaviour is still the same (i.e. getting the value from `pekko.stream.testkit.all-stages-stopped-timeout`) but if you decide to override it then you can do it the ScalaTest specific way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "jxnu-liguobin (via GitHub)" <gi...@apache.org>.
jxnu-liguobin commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1756705231
##########
stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamConfiguration.scala:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.pekko.stream.testkit
+
+import org.apache.pekko.testkit.TestKitBase
+import org.scalatest.time.{ Millis, Span }
+
+import java.util.concurrent.TimeUnit
+
+trait StreamConfiguration extends TestKitBase {
+ case class StreamConfig(allStagesStoppedTimeout: Span = Span({
Review Comment:
It is possible to omit units and support more flexibility, but the code is slightly complex and for reference only.
```
import scala.jdk.DurationConverters._
import org.scalatest.time.Span._
system.settings.config.getDuration("pekko.stream.testkit.all-stages-stopped-timeout").toScala.convertDurationToSpan
```
I just saw this `{}` and wanted to make some changes. I looked at the Span code and found that it has convertDurationoSpan. You can do whatever you want.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1750089328
##########
stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala:
##########
@@ -27,10 +26,26 @@ import pekko.testkit.{ PekkoSpec, TestProbe }
import pekko.testkit.TestKitUtils
import org.scalatest.Failed
+import org.scalatest.time.{ Millis, Span }
import com.typesafe.config.{ Config, ConfigFactory }
+import java.util.concurrent.TimeUnit
+
abstract class StreamSpec(_system: ActorSystem) extends PekkoSpec(_system) {
+
+ final case class StreamConfig(allStagesStoppedTimeout: Span = Span({
Review Comment:
This might look a bit un-orthodox by Pekko standards, but it is the idiomatic way to override a configuration when in ScalaTest (which is what `StreamSpec` extends).
The defaault behaviour is still the same (i.e. getting the value from `pekko.stream.testkit.all-stages-stopped-timeout`) but if you decide to override it then you can do it the ScalaTest specific way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on PR #1468:
URL: https://github.com/apache/pekko/pull/1468#issuecomment-2345512906
Adding some reviewers to this PR to get an idea whether its even on the right track, @jrudolph @raboof Maybe you have some comments?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1749706156
##########
stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/scaladsl/StreamTestKit.scala:
##########
@@ -35,12 +35,30 @@ object StreamTestKit {
* This assertion is useful to check that all of the stages have
* terminated successfully.
*/
+ def assertAllStagesStopped[T](block: => T, overrideTimeout: FiniteDuration)(implicit materializer: Materializer): T =
+ materializer match {
Review Comment:
There is code duplication here, I can clean it up if the premise of this PR is acceptable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1920936961
##########
stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/scaladsl/StreamTestKit.scala:
##########
@@ -53,10 +71,15 @@ object StreamTestKit {
}
/** INTERNAL API */
- @InternalApi private[testkit] def assertNoChildren(sys: ActorSystem, supervisor: ActorRef): Unit = {
+ @InternalApi private[testkit] def assertNoChildren(sys: ActorSystem, supervisor: ActorRef,
Review Comment:
add an overloaded method here to avoid the mima issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1756325644
##########
stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamConfiguration.scala:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.pekko.stream.testkit
+
+import org.apache.pekko.testkit.TestKitBase
+import org.scalatest.time.{ Millis, Span }
+
+import java.util.concurrent.TimeUnit
+
+trait StreamConfiguration extends TestKitBase {
+ case class StreamConfig(allStagesStoppedTimeout: Span = Span({
Review Comment:
The premise here is that by default we get the timeout value from Pekko typesafe config (as is expected when using Pekko) however if a user wants to override this then its done the ScalaTest idiomatic way (which is overriding a `def` in a trait, similar to how `PatienceConfig` works).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on PR #1468:
URL: https://github.com/apache/pekko/pull/1468#issuecomment-2613932796
Cool, nice to see @pjfanning carry it on
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #1468:
URL: https://github.com/apache/pekko/pull/1468
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1749990316
##########
stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala:
##########
Review Comment:
Not sure if this is the best way to configure the timeout for scalatest, another more idiomatic way would be to add a `StreamTimeout` configuration which defaults to whats loaded in typesafe config.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] Add overridden duration timeout to StreamTestKit [pekko]
Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #1468:
URL: https://github.com/apache/pekko/pull/1468#discussion_r1750149173
##########
stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamConfiguration.scala:
##########
Review Comment:
This might look a bit un-orthodox by Pekko standards, but it is the idiomatic way to override a configuration when in ScalaTest (which is what `StreamSpec` extends).
The defaault behaviour is still the same (i.e. getting the value from `pekko.stream.testkit.all-stages-stopped-timeout`) but if you decide to override it then you can do it the ScalaTest specific way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org