Skip to content

Commit 6eeb04d

Browse files
authored
V3 pre-merge; all the early bits, for V2 (#3028)
* minimal pre-v3 consolidation: - add RESPite to the solution, but *DO NOT* reference from SE.Redis - update eng tooling and migrate field parsing from FastHash to AsciiHash - update the toy server *completely* to the v3 specification * - backport LCS and RedisType.VectorSet changes from v3 * CI * tidy TFMs * nix TestHarness * deal with TFM-specific warnings from .NET 10 * in-proc test enhancements * fix Select * fix "fromBytes" logic to be more formal, and more importantly: to keep Nick happy * make DebugAssertValid logic #if DEBUG * cleanup a great many #if * join NET7 => NET8 * join net9 with net10 * fix high integrity token check on AUTH/HELLO * borked a #endif * Use a better way of refing the build project * clarify public API files * exclude Build.csproj from refing the analyzer project! * - improve "moved" test for "did the client already know the new node?" - fix where RESP3 default is specified for the toy server * make test server output more terse * toy server: don't pretend SENTINEL exists * rev minor * bump * Include endpoint data in log, for example `[127.0.0.1:6379 #1] CLIENT => +OK`
1 parent 583f393 commit 6eeb04d

File tree

152 files changed

+12912
-2122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+12912
-2122
lines changed

.github/workflows/CI.yml

Lines changed: 122 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@ jobs:
1717
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1" # Enable color output, even though the console output is redirected in Actions
1818
TERM: xterm # Enable color output in GitHub Actions
1919
steps:
20-
- name: Checkout code
21-
uses: actions/checkout@v4
22-
with:
23-
fetch-depth: 0 # Fetch the full history
24-
- name: Start Redis Services (docker-compose)
25-
working-directory: ./tests/RedisConfigs
26-
run: docker compose -f docker-compose.yml up -d --wait
27-
- name: Install .NET SDK
28-
uses: actions/setup-dotnet@v3
29-
with:
30-
dotnet-version: |
31-
6.0.x
32-
8.0.x
33-
10.0.x
34-
- name: .NET Build
35-
run: dotnet build Build.csproj -c Release /p:CI=true
36-
- name: StackExchange.Redis.Tests
37-
run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
38-
- uses: dorny/test-reporter@v1
39-
continue-on-error: true
40-
if: success() || failure()
41-
with:
42-
name: Test Results - Ubuntu
43-
path: 'test-results/*.trx'
44-
reporter: dotnet-trx
45-
- name: .NET Lib Pack
46-
run: dotnet pack src/StackExchange.Redis/StackExchange.Redis.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Fetch the full history
24+
- name: Start Redis Services (docker-compose)
25+
working-directory: ./tests/RedisConfigs
26+
run: docker compose -f docker-compose.yml up -d --wait
27+
- name: Install .NET SDK
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: |
31+
6.0.x
32+
8.0.x
33+
10.0.x
34+
- name: .NET Build
35+
run: dotnet build Build.csproj -c Release /p:CI=true
36+
- name: StackExchange.Redis.Tests
37+
run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
38+
- uses: dorny/test-reporter@v1
39+
continue-on-error: true
40+
if: success() || failure()
41+
with:
42+
name: Test Results - Ubuntu
43+
path: 'test-results/*.trx'
44+
reporter: dotnet-trx
45+
- name: .NET Lib Pack
46+
run: dotnet pack src/StackExchange.Redis/StackExchange.Redis.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
4747

4848
windows:
4949
name: StackExchange.Redis (Windows Server 2022)
@@ -54,99 +54,99 @@ jobs:
5454
TERM: xterm
5555
DOCKER_BUILDKIT: 1
5656
steps:
57-
- name: Checkout code
58-
uses: actions/checkout@v4
59-
with:
60-
fetch-depth: 0 # Fetch the full history
61-
- uses: Vampire/setup-wsl@v2
62-
with:
63-
distribution: Ubuntu-22.04
64-
- name: Install Redis
65-
shell: wsl-bash {0}
66-
working-directory: ./tests/RedisConfigs
67-
run: |
68-
apt-get update
69-
apt-get install curl gpg lsb-release libgomp1 jq -y
70-
curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
71-
chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
72-
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list
73-
apt-get update
74-
apt-get install -y redis
75-
mkdir redis
76-
- name: Run redis-server
77-
shell: wsl-bash {0}
78-
working-directory: ./tests/RedisConfigs/redis
79-
run: |
80-
pwd
81-
ls .
82-
# Run each server instance in order
83-
redis-server ../Basic/primary-6379.conf &
84-
redis-server ../Basic/replica-6380.conf &
85-
redis-server ../Basic/secure-6381.conf &
86-
redis-server ../Failover/primary-6382.conf &
87-
redis-server ../Failover/replica-6383.conf &
88-
redis-server ../Cluster/cluster-7000.conf --dir ../Cluster &
89-
redis-server ../Cluster/cluster-7001.conf --dir ../Cluster &
90-
redis-server ../Cluster/cluster-7002.conf --dir ../Cluster &
91-
redis-server ../Cluster/cluster-7003.conf --dir ../Cluster &
92-
redis-server ../Cluster/cluster-7004.conf --dir ../Cluster &
93-
redis-server ../Cluster/cluster-7005.conf --dir ../Cluster &
94-
redis-server ../Sentinel/redis-7010.conf &
95-
redis-server ../Sentinel/redis-7011.conf &
96-
redis-server ../Sentinel/sentinel-26379.conf --sentinel &
97-
redis-server ../Sentinel/sentinel-26380.conf --sentinel &
98-
redis-server ../Sentinel/sentinel-26381.conf --sentinel &
99-
# Wait for server instances to get ready
100-
sleep 5
101-
echo "Checking redis-server version with port 6379"
102-
redis-cli -p 6379 INFO SERVER | grep redis_version || echo "Failed to get version for port 6379"
103-
echo "Checking redis-server version with port 6380"
104-
redis-cli -p 6380 INFO SERVER | grep redis_version || echo "Failed to get version for port 6380"
105-
echo "Checking redis-server version with port 6381"
106-
redis-cli -p 6381 INFO SERVER | grep redis_version || echo "Failed to get version for port 6381"
107-
echo "Checking redis-server version with port 6382"
108-
redis-cli -p 6382 INFO SERVER | grep redis_version || echo "Failed to get version for port 6382"
109-
echo "Checking redis-server version with port 6383"
110-
redis-cli -p 6383 INFO SERVER | grep redis_version || echo "Failed to get version for port 6383"
111-
echo "Checking redis-server version with port 7000"
112-
redis-cli -p 7000 INFO SERVER | grep redis_version || echo "Failed to get version for port 7000"
113-
echo "Checking redis-server version with port 7001"
114-
redis-cli -p 7001 INFO SERVER | grep redis_version || echo "Failed to get version for port 7001"
115-
echo "Checking redis-server version with port 7002"
116-
redis-cli -p 7002 INFO SERVER | grep redis_version || echo "Failed to get version for port 7002"
117-
echo "Checking redis-server version with port 7003"
118-
redis-cli -p 7003 INFO SERVER | grep redis_version || echo "Failed to get version for port 7003"
119-
echo "Checking redis-server version with port 7004"
120-
redis-cli -p 7004 INFO SERVER | grep redis_version || echo "Failed to get version for port 7004"
121-
echo "Checking redis-server version with port 7005"
122-
redis-cli -p 7005 INFO SERVER | grep redis_version || echo "Failed to get version for port 7005"
123-
echo "Checking redis-server version with port 7010"
124-
redis-cli -p 7010 INFO SERVER | grep redis_version || echo "Failed to get version for port 7010"
125-
echo "Checking redis-server version with port 7011"
126-
redis-cli -p 7011 INFO SERVER | grep redis_version || echo "Failed to get version for port 7011"
127-
echo "Checking redis-server version with port 26379"
128-
redis-cli -p 26379 INFO SERVER | grep redis_version || echo "Failed to get version for port 26379"
129-
echo "Checking redis-server version with port 26380"
130-
redis-cli -p 26380 INFO SERVER | grep redis_version || echo "Failed to get version for port 26380"
131-
echo "Checking redis-server version with port 26381"
132-
redis-cli -p 26381 INFO SERVER | grep redis_version || echo "Failed to get version for port 26381"
133-
continue-on-error: true
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0 # Fetch the full history
61+
- uses: Vampire/setup-wsl@v2
62+
with:
63+
distribution: Ubuntu-22.04
64+
- name: Install Redis
65+
shell: wsl-bash {0}
66+
working-directory: ./tests/RedisConfigs
67+
run: |
68+
apt-get update
69+
apt-get install curl gpg lsb-release libgomp1 jq -y
70+
curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
71+
chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
72+
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list
73+
apt-get update
74+
apt-get install -y redis
75+
mkdir redis
76+
- name: Run redis-server
77+
shell: wsl-bash {0}
78+
working-directory: ./tests/RedisConfigs/redis
79+
run: |
80+
pwd
81+
ls .
82+
# Run each server instance in order
83+
redis-server ../Basic/primary-6379.conf &
84+
redis-server ../Basic/replica-6380.conf &
85+
redis-server ../Basic/secure-6381.conf &
86+
redis-server ../Failover/primary-6382.conf &
87+
redis-server ../Failover/replica-6383.conf &
88+
redis-server ../Cluster/cluster-7000.conf --dir ../Cluster &
89+
redis-server ../Cluster/cluster-7001.conf --dir ../Cluster &
90+
redis-server ../Cluster/cluster-7002.conf --dir ../Cluster &
91+
redis-server ../Cluster/cluster-7003.conf --dir ../Cluster &
92+
redis-server ../Cluster/cluster-7004.conf --dir ../Cluster &
93+
redis-server ../Cluster/cluster-7005.conf --dir ../Cluster &
94+
redis-server ../Sentinel/redis-7010.conf &
95+
redis-server ../Sentinel/redis-7011.conf &
96+
redis-server ../Sentinel/sentinel-26379.conf --sentinel &
97+
redis-server ../Sentinel/sentinel-26380.conf --sentinel &
98+
redis-server ../Sentinel/sentinel-26381.conf --sentinel &
99+
# Wait for server instances to get ready
100+
sleep 5
101+
echo "Checking redis-server version with port 6379"
102+
redis-cli -p 6379 INFO SERVER | grep redis_version || echo "Failed to get version for port 6379"
103+
echo "Checking redis-server version with port 6380"
104+
redis-cli -p 6380 INFO SERVER | grep redis_version || echo "Failed to get version for port 6380"
105+
echo "Checking redis-server version with port 6381"
106+
redis-cli -p 6381 INFO SERVER | grep redis_version || echo "Failed to get version for port 6381"
107+
echo "Checking redis-server version with port 6382"
108+
redis-cli -p 6382 INFO SERVER | grep redis_version || echo "Failed to get version for port 6382"
109+
echo "Checking redis-server version with port 6383"
110+
redis-cli -p 6383 INFO SERVER | grep redis_version || echo "Failed to get version for port 6383"
111+
echo "Checking redis-server version with port 7000"
112+
redis-cli -p 7000 INFO SERVER | grep redis_version || echo "Failed to get version for port 7000"
113+
echo "Checking redis-server version with port 7001"
114+
redis-cli -p 7001 INFO SERVER | grep redis_version || echo "Failed to get version for port 7001"
115+
echo "Checking redis-server version with port 7002"
116+
redis-cli -p 7002 INFO SERVER | grep redis_version || echo "Failed to get version for port 7002"
117+
echo "Checking redis-server version with port 7003"
118+
redis-cli -p 7003 INFO SERVER | grep redis_version || echo "Failed to get version for port 7003"
119+
echo "Checking redis-server version with port 7004"
120+
redis-cli -p 7004 INFO SERVER | grep redis_version || echo "Failed to get version for port 7004"
121+
echo "Checking redis-server version with port 7005"
122+
redis-cli -p 7005 INFO SERVER | grep redis_version || echo "Failed to get version for port 7005"
123+
echo "Checking redis-server version with port 7010"
124+
redis-cli -p 7010 INFO SERVER | grep redis_version || echo "Failed to get version for port 7010"
125+
echo "Checking redis-server version with port 7011"
126+
redis-cli -p 7011 INFO SERVER | grep redis_version || echo "Failed to get version for port 7011"
127+
echo "Checking redis-server version with port 26379"
128+
redis-cli -p 26379 INFO SERVER | grep redis_version || echo "Failed to get version for port 26379"
129+
echo "Checking redis-server version with port 26380"
130+
redis-cli -p 26380 INFO SERVER | grep redis_version || echo "Failed to get version for port 26380"
131+
echo "Checking redis-server version with port 26381"
132+
redis-cli -p 26381 INFO SERVER | grep redis_version || echo "Failed to get version for port 26381"
133+
continue-on-error: true
134134

135-
- name: .NET Build
136-
run: dotnet build Build.csproj -c Release /p:CI=true
137-
- name: StackExchange.Redis.Tests
138-
run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
139-
- uses: dorny/test-reporter@v1
140-
continue-on-error: true
141-
if: success() || failure()
142-
with:
143-
name: Tests Results - Windows Server 2022
144-
path: 'test-results/*.trx'
145-
reporter: dotnet-trx
146-
# Package and upload to MyGet only on pushes to main, not on PRs
147-
- name: .NET Pack
148-
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
149-
run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=${env:GITHUB_WORKSPACE}\.nupkgs /p:CI=true
150-
- name: Upload to MyGet
151-
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
152-
run: dotnet nuget push ${env:GITHUB_WORKSPACE}\.nupkgs\*.nupkg -s https://www.myget.org/F/stackoverflow/api/v2/package -k ${{ secrets.MYGET_API_KEY }}
135+
- name: .NET Build
136+
run: dotnet build Build.csproj -c Release /p:CI=true
137+
- name: StackExchange.Redis.Tests
138+
run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
139+
- uses: dorny/test-reporter@v1
140+
continue-on-error: true
141+
if: success() || failure()
142+
with:
143+
name: Tests Results - Windows Server 2022
144+
path: 'test-results/*.trx'
145+
reporter: dotnet-trx
146+
# Package and upload to MyGet only on pushes to main, not on PRs
147+
- name: .NET Pack
148+
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
149+
run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=${env:GITHUB_WORKSPACE}\.nupkgs /p:CI=true
150+
- name: Upload to MyGet
151+
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
152+
run: dotnet nuget push ${env:GITHUB_WORKSPACE}\.nupkgs\*.nupkg -s https://www.myget.org/F/stackoverflow/api/v2/package -k ${{ secrets.MYGET_API_KEY }}

.github/workflows/codeql.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
# The branches below must be a subset of the branches above
88
branches: [ 'main' ]
99
workflow_dispatch:
10-
10+
1111
schedule:
1212
- cron: '8 9 * * 1'
1313

@@ -30,33 +30,34 @@ jobs:
3030
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3131

3232
steps:
33-
- name: Checkout repository
34-
uses: actions/checkout@v4
35-
with:
36-
fetch-depth: 0
37-
38-
- name: Setup .NET
39-
uses: actions/setup-dotnet@v4
40-
with:
41-
dotnet-version: '9.0.x'
42-
43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v4
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
52-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53-
# queries: security-extended,security-and-quality
54-
55-
- if: matrix.language == 'csharp'
56-
name: .NET Build
57-
run: dotnet build Build.csproj -c Release /p:CI=true
58-
59-
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@v4
61-
with:
62-
category: "/language:${{matrix.language}}"
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Setup .NET
39+
uses: actions/setup-dotnet@v4
40+
with:
41+
dotnet-version: |
42+
10.0.x
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v4
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
53+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
54+
# queries: security-extended,security-and-quality
55+
56+
- if: matrix.language == 'csharp'
57+
name: .NET Build
58+
run: dotnet build Build.csproj -c Release /p:CI=true
59+
60+
- name: Perform CodeQL Analysis
61+
uses: github/codeql-action/analyze@v4
62+
with:
63+
category: "/language:${{matrix.language}}"

Build.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Project Sdk="Microsoft.Build.Traversal/3.0.2">
22
<ItemGroup>
3+
<ProjectReference Include="eng\**\*.csproj" />
34
<ProjectReference Include="src\**\*.csproj" />
45
<ProjectReference Include="tests\**\*.csproj" />
56
<ProjectReference Include="toys\**\*.csproj" />

Directory.Build.props

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1111
<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)Shared.ruleset</CodeAnalysisRuleset>
1212
<MSBuildWarningsAsMessages>NETSDK1069</MSBuildWarningsAsMessages>
13-
<NoWarn>$(NoWarn);NU5105;NU1507;SER001;SER002;SER003</NoWarn>
13+
<NoWarn>$(NoWarn);NU5105;NU1507;SER001;SER002;SER003;SER004;SER005</NoWarn>
1414
<PackageReleaseNotes>https://stackexchange.github.io/StackExchange.Redis/ReleaseNotes</PackageReleaseNotes>
1515
<PackageProjectUrl>https://stackexchange.github.io/StackExchange.Redis/</PackageProjectUrl>
1616
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -42,4 +42,10 @@
4242
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="all" />
4343
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" />
4444
</ItemGroup>
45+
46+
<ItemGroup Condition="'$(MSBuildProjectName)' != 'Build' and '$(MSBuildProjectName)' != 'StackExchange.Redis.Build'">
47+
<!-- for everything except the build-tools project itself and the Build.csproj wrapper: use the build project as an analyzer -->
48+
<ProjectReference Include="..\..\eng\StackExchange.Redis.Build\StackExchange.Redis.Build.csproj"
49+
OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
50+
</ItemGroup>
4551
</Project>

Directory.Packages.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
1111
<!-- note that this bumps System.Buffers, so is pinned in down-level in SE csproj -->
1212
<PackageVersion Include="System.IO.Hashing" Version="10.0.2" />
13+
<!-- for RESPite -->
14+
<PackageVersion Include="System.Buffers" Version="4.6.1" />
15+
<PackageVersion Include="System.Memory" Version="4.6.1" />
1316

1417
<!-- For analyzers, tied to the consumer's build SDK; at the moment, that means "us" -->
1518
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />

0 commit comments

Comments
 (0)