Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-02-16 Thread via GitHub


bruno-roustant commented on PR #3026:
URL: https://github.com/apache/solr/pull/3026#issuecomment-2661389121

   Oh I didn't realize there was this PR waiting and with nice tests... sorry 
@sandbergja !
   (and thanks David for pointing it to me)


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-02-15 Thread via GitHub


epugh commented on PR #3026:
URL: https://github.com/apache/solr/pull/3026#issuecomment-2661202254

   Sure...   I'll close it then, however I would love to see more commits.  
Speak up if you are looking for ideas..  especially on the [email protected] 
mailing list.  Or in Slack.  Or any where ;-)


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-02-15 Thread via GitHub


epugh closed pull request #3026: SOLR-17618: Add unit tests for 
org.apache.solr.util.TimeOut
URL: https://github.com/apache/solr/pull/3026


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-02-15 Thread via GitHub


sandbergja commented on PR #3026:
URL: https://github.com/apache/solr/pull/3026#issuecomment-2661201387

   Thanks, @epugh (and everyone else who helped me with this)!  It looks like 
#3173 added tests that exercise all the methods exercised in this PR, so I 
don't think this PR adds much value.  I'm tempted to close this one, and find 
something else to work on instead. :-)


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-02-15 Thread via GitHub


epugh commented on PR #3026:
URL: https://github.com/apache/solr/pull/3026#issuecomment-2661194114

   @sandbergja I don't want to lose this great work, can you sync it up and 
then let's merge it!


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-01-12 Thread via GitHub


sandbergja commented on code in PR #3026:
URL: https://github.com/apache/solr/pull/3026#discussion_r1912501591


##
solr/core/src/test/org/apache/solr/util/TimeOutTest.java:
##
@@ -0,0 +1,65 @@
+/*
+ * 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.solr.util;
+
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.util.TimeSource;
+import org.junit.BeforeClass;
+
+public class TimeOutTest extends SolrTestCaseJ4 {
+
+  @BeforeClass
+  public static void setUpOnce() {
+assumeWorkingMockito();
+  }
+
+  public void testHasTimedOut() {
+TimeSource mockTimeSource = mock(TimeSource.class);

Review Comment:
   Okay!  I think I get it now.  Thanks for working with me on this @madrob !



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-01-12 Thread via GitHub


madrob commented on code in PR #3026:
URL: https://github.com/apache/solr/pull/3026#discussion_r1912499016


##
solr/core/src/test/org/apache/solr/util/TimeOutTest.java:
##
@@ -0,0 +1,65 @@
+/*
+ * 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.solr.util;
+
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.util.TimeSource;
+import org.junit.BeforeClass;
+
+public class TimeOutTest extends SolrTestCaseJ4 {
+
+  @BeforeClass
+  public static void setUpOnce() {
+assumeWorkingMockito();
+  }
+
+  public void testHasTimedOut() {
+TimeSource mockTimeSource = mock(TimeSource.class);

Review Comment:
   I would do Before, not BeforeClass for it, and also put the when/thenReturn 
line in there as well.
   
   Then in the tests adjust the timeouts to test various combinations if we 
have the same mock time source each time. Does that make sense?



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-01-12 Thread via GitHub


sandbergja commented on code in PR #3026:
URL: https://github.com/apache/solr/pull/3026#discussion_r1912491090


##
solr/core/src/test/org/apache/solr/util/TimeOutTest.java:
##
@@ -0,0 +1,65 @@
+/*
+ * 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.solr.util;
+
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.util.TimeSource;
+import org.junit.BeforeClass;
+
+public class TimeOutTest extends SolrTestCaseJ4 {
+
+  @BeforeClass
+  public static void setUpOnce() {
+assumeWorkingMockito();
+  }
+
+  public void testHasTimedOut() {
+TimeSource mockTimeSource = mock(TimeSource.class);

Review Comment:
   Ooh, good point!  Thanks, @madrob !



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-01-12 Thread via GitHub


sandbergja commented on code in PR #3026:
URL: https://github.com/apache/solr/pull/3026#discussion_r1912491073


##
solr/core/src/test/org/apache/solr/util/TimeOutTest.java:
##
@@ -0,0 +1,65 @@
+/*
+ * 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.solr.util;
+
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.util.TimeSource;
+import org.junit.BeforeClass;
+
+public class TimeOutTest extends SolrTestCaseJ4 {
+
+  @BeforeClass
+  public static void setUpOnce() {
+assumeWorkingMockito();
+  }
+
+  public void testHasTimedOut() {

Review Comment:
   Thanks, I was wondering about that!



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut [solr]

2025-01-12 Thread via GitHub


madrob commented on code in PR #3026:
URL: https://github.com/apache/solr/pull/3026#discussion_r1912473651


##
solr/core/src/test/org/apache/solr/util/TimeOutTest.java:
##
@@ -0,0 +1,65 @@
+/*
+ * 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.solr.util;
+
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.util.TimeSource;
+import org.junit.BeforeClass;
+
+public class TimeOutTest extends SolrTestCaseJ4 {
+
+  @BeforeClass
+  public static void setUpOnce() {
+assumeWorkingMockito();
+  }
+
+  public void testHasTimedOut() {
+TimeSource mockTimeSource = mock(TimeSource.class);

Review Comment:
   This could go in a Before method



##
solr/core/src/test/org/apache/solr/util/TimeOutTest.java:
##
@@ -0,0 +1,65 @@
+/*
+ * 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.solr.util;
+
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.util.TimeSource;
+import org.junit.BeforeClass;
+
+public class TimeOutTest extends SolrTestCaseJ4 {
+
+  @BeforeClass
+  public static void setUpOnce() {
+assumeWorkingMockito();
+  }
+
+  public void testHasTimedOut() {

Review Comment:
   Does this need Test annotations 



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]