Copilot commented on code in PR #6714:
URL: https://github.com/apache/texera/pull/6714#discussion_r3626561386


##########
computing-unit-managing-service/src/test/scala/org/apache/texera/service/resource/ComputingUnitAccessSharingDisabledSpec.scala:
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.texera.service.resource
+
+import jakarta.ws.rs.ForbiddenException
+import org.apache.texera.auth.SessionUser
+import org.apache.texera.common.config.ComputingUnitConfig
+import org.apache.texera.dao.MockTexeraDB
+import org.apache.texera.dao.jooq.generated.enums.{PrivilegeEnum, UserRoleEnum}
+import org.apache.texera.dao.jooq.generated.tables.pojos.User
+import org.scalatest.BeforeAndAfterAll
+import org.scalatest.flatspec.AnyFlatSpec
+import org.scalatest.matchers.should.Matchers
+
+/**
+  * Spec for [[ComputingUnitAccessResource]] when the sharing feature is 
DISABLED.
+  *
+  * `ComputingUnitConfig.sharingComputingUnitEnabled` is a load-time val 
resolved from the
+  * COMPUTING_UNIT_SHARING_ENABLED env var, so the disabled branch can only be 
exercised in a
+  * JVM where that var is absent. build.sbt's `Test / testGrouping` drops the 
var for any suite
+  * whose name ends with "SharingDisabledSpec", so this suite forks separately 
with sharing off.
+  * The first assertion guards that grouping — if it ever stops applying, this 
suite fails loudly

Review Comment:
   The Scaladoc claims the disabled branch can only be tested when 
`COMPUTING_UNIT_SHARING_ENABLED` is absent, but in practice it's enough (and 
more robust) for the forked JVM to have the variable overridden to `false` 
(since the config default is already `false`). If you change the sbt grouping 
to explicitly set the var to `false`, please update this comment to match so it 
doesn't mislead future maintainers.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to