Skip to content

Commit 587eb7b

Browse files
Merge branch '3.1.x' into 3.2.x
2 parents f4b6f09 + bde989f commit 587eb7b

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryDynamicITests.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
import java.util.Map;
2121
import java.util.function.BiFunction;
2222

23-
import io.lettuce.core.RedisCommandExecutionException;
2423
import org.junit.jupiter.api.Test;
2524
import org.junit.jupiter.api.extension.ExtendWith;
2625

2726
import org.springframework.context.annotation.Bean;
2827
import org.springframework.context.annotation.Configuration;
29-
import org.springframework.data.redis.RedisSystemException;
3028
import org.springframework.data.redis.core.BoundHashOperations;
3129
import org.springframework.data.redis.core.RedisOperations;
3230
import org.springframework.session.MapSession;
@@ -43,7 +41,6 @@
4341
import static org.mockito.ArgumentMatchers.anyString;
4442
import static org.mockito.BDDMockito.given;
4543
import static org.mockito.BDDMockito.willAnswer;
46-
import static org.mockito.Mockito.doThrow;
4744
import static org.mockito.Mockito.spy;
4845

4946
/**
@@ -99,30 +96,6 @@ void findByIdWhenSessionDeletedWhileSavingDeltaAndSafeMapperThenSessionIsNull()
9996
assertThat(this.sessionRepository.findById(session.getId())).isNull();
10097
}
10198

102-
// gh-1743
103-
@Test
104-
@SuppressWarnings("unchecked")
105-
void saveChangeSessionIdWhenFailedRenameOperationExceptionContainsMoreDetailsThenIgnoreError() {
106-
this.context.register(Config.class);
107-
refreshAndPrepareFields();
108-
109-
RedisSession toSave = this.sessionRepository.createSession();
110-
String sessionId = toSave.getId();
111-
112-
this.sessionRepository.save(toSave);
113-
RedisSession session = this.sessionRepository.findById(sessionId);
114-
this.sessionRepository.deleteById(sessionId);
115-
String newSessionId = session.changeSessionId();
116-
117-
RedisSystemException redisSystemException = new RedisSystemException(null,
118-
new RedisCommandExecutionException("ERR no such key. channel: [id: 0xec125091,..."));
119-
doThrow(redisSystemException).when(this.spyOperations).rename(any(), any());
120-
121-
this.sessionRepository.save(session);
122-
assertThat(this.sessionRepository.findById(sessionId)).isNull();
123-
assertThat(this.sessionRepository.findById(newSessionId)).isNull();
124-
}
125-
12699
@SuppressWarnings("unchecked")
127100
private void refreshAndPrepareFields() {
128101
this.context.refresh();

spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisIndexedSessionRepositoryITests.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.springframework.test.context.web.WebAppConfiguration;
4848

4949
import static org.assertj.core.api.Assertions.assertThat;
50+
import static org.assertj.core.api.Assertions.assertThatNoException;
5051

5152
/**
5253
* Integration tests for {@link RedisIndexedSessionRepository}.
@@ -682,6 +683,20 @@ void changeSessionIdSaveConcurrently() {
682683
assertThat(this.repository.findById(copy2.getId())).isNull();
683684
}
684685

686+
// gh-1743
687+
@Test
688+
void saveChangeSessionIdWhenFailedRenameOperationExceptionThenIgnoreError() {
689+
RedisSession toSave = this.repository.createSession();
690+
String sessionId = toSave.getId();
691+
692+
this.repository.save(toSave);
693+
RedisSession session = this.repository.findById(sessionId);
694+
this.repository.deleteById(sessionId);
695+
session.changeSessionId();
696+
697+
assertThatNoException().isThrownBy(() -> this.repository.save(session));
698+
}
699+
685700
private String getSecurityName() {
686701
return this.context.getAuthentication().getName();
687702
}

0 commit comments

Comments
 (0)