From 00c658d8bee47971e32d6d28ee2558f6996180cc Mon Sep 17 00:00:00 2001 From: Gyorgy Gal <27883675+gyogal@users.noreply.github.com> Date: Thu, 17 Sep 2026 15:38:36 -0400 Subject: [PATCH] [LIVY-1085][TEST] Skip remaining R test paths when -DskipRTests is specified Two R-dependent tests (SharedSessionSpec, InteractiveSessionSpec) ran a real sparkr interpreter even with -DskipRTests=true, unlike every other R test in the suite. Guard both with the same sys.props pattern already used by SparkRInterpreterSpec/SparkRSessionSpec/BatchIT/InteractiveIT, and make InteractiveSessionSpec's downstream execution_count expectation conditional on the flag, since it depends on the skipped R statement having incremented the session's shared statement counter. Verified via mvn test runs of both specs with -DskipRTests=true (R test cancels, rest pass) and the default -DskipRTests=false on a machine with R installed. Generated-by: Claude Code (claude-sonnet-5) --- .../apache/livy/repl/SharedSessionSpec.scala | 1 + .../interactive/InteractiveSessionSpec.scala | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/repl/src/test/scala/org/apache/livy/repl/SharedSessionSpec.scala b/repl/src/test/scala/org/apache/livy/repl/SharedSessionSpec.scala index 3c0b998ff..dbcc006ae 100644 --- a/repl/src/test/scala/org/apache/livy/repl/SharedSessionSpec.scala +++ b/repl/src/test/scala/org/apache/livy/repl/SharedSessionSpec.scala @@ -108,6 +108,7 @@ class SharedSessionSpec extends BaseSessionSpec(Shared) { } it should "execute `1 + 2 = 3` in R" in withSession { session => + assume(!sys.props.getOrElse("skipRTests", "false").toBoolean, "Skipping R tests.") val statement = execute(session, "1 + 2", "sparkr") statement.id should be (0) diff --git a/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionSpec.scala b/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionSpec.scala index 1efa266ac..5806f147c 100644 --- a/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionSpec.scala +++ b/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionSpec.scala @@ -56,6 +56,7 @@ class InteractiveSessionSpec extends AnyFunSpec private var session: InteractiveSession = null private val accessManager = new AccessManager(livyConf) + private val skipRTests = sys.props.getOrElse("skipRTests", "false").toBoolean private def createSession( sessionStore: SessionStore = mock[SessionStore], @@ -211,19 +212,21 @@ class InteractiveSessionSpec extends AnyFunSpec (scalaResult \ "status").extract[String] should equal ("ok") (scalaResult \ "execution_count").extract[Int] should equal (1) - val rResult = executeStatement("1 + 2", Some("sparkr")) - rResult should equal (Extraction.decompose(Map( - "status" -> "ok", - "execution_count" -> 2, - "data" -> Map("text/plain" -> "[1] 3"))) - ) + if (!skipRTests) { + val rResult = executeStatement("1 + 2", Some("sparkr")) + rResult should equal (Extraction.decompose(Map( + "status" -> "ok", + "execution_count" -> 2, + "data" -> Map("text/plain" -> "[1] 3"))) + ) + } } withSession("should report an error if accessing an unknown variable") { session => val result = executeStatement("x") val expectedResult = Extraction.decompose(Map( "status" -> "error", - "execution_count" -> 3, + "execution_count" -> (if (skipRTests) 2 else 3), "ename" -> "NameError", "evalue" -> "name 'x' is not defined", "traceback" -> List(