Skip to content

Commit 837113b

Browse files
authored
Merge pull request #647 from kevin-lee/fix/646/broken-test
Fix #646 - Fix the broken test: `effectie.instances.future.fxSpec.FutureSpec.testFromEffectWithPure`
2 parents 65ef0d2 + e0e4cf4 commit 837113b

6 files changed

Lines changed: 37 additions & 34 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
branches:
1010
- main
1111

12+
env:
13+
GH_JVM_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=2G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
14+
1215
jobs:
1316

1417
build:
@@ -36,6 +39,7 @@ jobs:
3639
CURRENT_BRANCH_NAME: ${{ github.ref }}
3740
RUN_ID: ${{ github.run_id }}
3841
RUN_NUMBER: ${{ github.run_number }}
42+
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
3943
run: |
4044
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
4145
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}"
@@ -53,6 +57,7 @@ jobs:
5357
RUN_ID: ${{ github.run_id }}
5458
RUN_NUMBER: ${{ github.run_number }}
5559
PR_NUMBER: ${{ github.event.pull_request.number }}
60+
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
5661
run: |
5762
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch"
5863
echo "RUN_ID=${RUN_ID}"

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- main
1111

1212
env:
13-
GH_JVM_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=1G -Xmx2G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
13+
GH_JVM_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=2G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
1414

1515
jobs:
1616

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ on:
1111
- 'effectie-1'
1212

1313
env:
14-
GH_SBT_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=1G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions"
15-
GH_JVM_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=1G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
14+
GH_SBT_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=2G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions"
15+
GH_JVM_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=2G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
1616

1717
jobs:
1818

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
env:
1111
GH_JAVA_VERSION: "11"
1212
GH_JAVA_DISTRIBUTION: "temurin"
13-
GH_JVM_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=1G -Xmx2G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
13+
GH_JVM_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=2G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
1414

1515

1616
jobs:
@@ -82,6 +82,7 @@ jobs:
8282
CURRENT_BRANCH_NAME: ${{ github.ref }}
8383
RUN_ID: ${{ github.run_id }}
8484
RUN_NUMBER: ${{ github.run_number }}
85+
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
8586
run: |
8687
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
8788
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}"

modules/effectie-cats/shared/src/test/scala/effectie/instances/id/fxSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object fxSpec extends Properties {
2626
private implicit val errorLogger: ErrorLogger[Throwable] = ErrorLogger.printlnDefaultErrorLogger
2727

2828
/* Future */
29-
private val futureSpecs = effectie.instances.future.fxSpec.futureSpecs ++
29+
private val futureSpecs = effectie.instances.future.fxSpec.futureSpecs(getClass.getName.stripSuffix("$")) ++
3030
List(
3131
example(
3232
"test Fx[Future]catchNonFatalEitherT should catch NonFatal",

modules/effectie-core/shared/src/test/scala/effectie/instances/future/fxSpec.scala

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@ import scala.util.Try
2020
object fxSpec extends Properties {
2121
implicit private val errorLogger: ErrorLogger[Throwable] = ErrorLogger.printlnDefaultErrorLogger
2222

23-
override def tests: List[Test] = futureSpecs
23+
override def tests: List[Test] = futureSpecs(getClass.getName.stripSuffix("$"))
2424

2525
/* Future */
26-
val futureSpecs = List(
27-
property("test Fx[Future].effectOf", FutureSpec.testEffectOf),
28-
property("test Fx[Future].fromEffect(effectOf)", FutureSpec.testFromEffect),
29-
property("test Fx[Future].fromEffect(pureOf)", FutureSpec.testFromEffectWithPure),
30-
property("test Fx[Future].pureOf", FutureSpec.testPureOf),
31-
property("test Fx[Future].pureOrError(success case)", FutureSpec.testPureOrErrorSuccessCase),
32-
example("test Fx[Future].pureOrError(error case)", FutureSpec.testPureOrErrorErrorCase),
33-
example("test Fx[Future].unitOf", FutureSpec.testUnitOf),
34-
example("test Fx[Future].errorOf", FutureSpec.testErrorOf),
35-
property("test fx.pureOfOption[Future]", FutureSpec.testPureOfOption),
36-
property("test fx.pureOfSome[Future]", FutureSpec.testPureOfSome),
37-
example("test fx.pureOfNone[Future]", FutureSpec.testPureOfNone),
38-
property("test fx.pureOfRight[Future]", FutureSpec.testPureOfRight),
39-
property("test fx.pureOfLeft[Future]", FutureSpec.testPureOfLeft),
40-
property("test Fx[Future].fromEither(Right)", FutureSpec.testFromEitherRightCase),
41-
property("test Fx[Future].fromEither(Left)", FutureSpec.testFromEitherLeftCase),
42-
property("test Fx[Future].fromOption(Some)", FutureSpec.testFromOptionSomeCase),
43-
property("test Fx[Future].fromOption(None)", FutureSpec.testFromOptionNoneCase),
44-
property("test Fx[Future].fromTry(Success)", FutureSpec.testFromTrySuccessCase),
45-
property("test Fx[Future].fromTry(Failure)", FutureSpec.testFromTryFailureCase),
46-
property("test Fx[Future].flatMapFa(Future[A])(A => IO[B])", FutureSpec.testFlatMapFx),
26+
def futureSpecs(name: String): List[Test] = List(
27+
property(s"from $name: test Fx[Future].effectOf", FutureSpec.testEffectOf),
28+
property(s"from $name: test Fx[Future].fromEffect(effectOf)", FutureSpec.testFromEffect),
29+
property(s"from $name: test Fx[Future].fromEffect(pureOf)", FutureSpec.testFromEffectWithPure),
30+
property(s"from $name: test Fx[Future].pureOf", FutureSpec.testPureOf),
31+
property(s"from $name: test Fx[Future].pureOrError(success case)", FutureSpec.testPureOrErrorSuccessCase),
32+
example(s"from $name: test Fx[Future].pureOrError(error case)", FutureSpec.testPureOrErrorErrorCase),
33+
example(s"from $name: test Fx[Future].unitOf", FutureSpec.testUnitOf),
34+
example(s"from $name: test Fx[Future].errorOf", FutureSpec.testErrorOf),
35+
property(s"from $name: test fx.pureOfOption[Future]", FutureSpec.testPureOfOption),
36+
property(s"from $name: test fx.pureOfSome[Future]", FutureSpec.testPureOfSome),
37+
example(s"from $name: test fx.pureOfNone[Future]", FutureSpec.testPureOfNone),
38+
property(s"from $name: test fx.pureOfRight[Future]", FutureSpec.testPureOfRight),
39+
property(s"from $name: test fx.pureOfLeft[Future]", FutureSpec.testPureOfLeft),
40+
property(s"from $name: test Fx[Future].fromEither(Right)", FutureSpec.testFromEitherRightCase),
41+
property(s"from $name: test Fx[Future].fromEither(Left)", FutureSpec.testFromEitherLeftCase),
42+
property(s"from $name: test Fx[Future].fromOption(Some)", FutureSpec.testFromOptionSomeCase),
43+
property(s"from $name: test Fx[Future].fromOption(None)", FutureSpec.testFromOptionNoneCase),
44+
property(s"from $name: test Fx[Future].fromTry(Success)", FutureSpec.testFromTrySuccessCase),
45+
property(s"from $name: test Fx[Future].fromTry(Failure)", FutureSpec.testFromTryFailureCase),
46+
property(s"from $name: test Fx[Future].flatMapFa(Future[A])(A => IO[B])", FutureSpec.testFlatMapFx),
4747
) ++
4848
FutureSpec.testMonadLaws ++
4949
List(
@@ -280,17 +280,14 @@ object fxSpec extends Properties {
280280
ConcurrentSupport.newExecutionContext(executorService, ErrorLogger.printlnExecutionContextErrorLogger)
281281

282282
@SuppressWarnings(Array("org.wartremover.warts.Var"))
283-
var actual = before // scalafix:ok DisableSyntax.var
284-
val testBefore = actual ==== before
285-
val fromFuture = Fx[Future].fromEffect(Fx[Future].pureOf({ actual = after; () }))
286-
val testAfterFrom = actual ==== before
287-
// val testAfterFrom = actual ==== after
283+
var actual = before // scalafix:ok DisableSyntax.var
284+
val testBefore = actual ==== before
285+
val fromFuture = Fx[Future].fromEffect(Fx[Future].pureOf({ actual = after; () }))
288286
ConcurrentSupport.futureToValueAndTerminate(executorService, waitFor)(fromFuture)
289-
val testAfterRun = actual ==== after
287+
val testAfterRun = actual ==== after
290288
Result.all(
291289
List(
292290
testBefore.log("testBefore"),
293-
testAfterFrom.log("testAfterFrom"),
294291
testAfterRun.log("testAfterRun"),
295292
)
296293
)

0 commit comments

Comments
 (0)