Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ dotnet test src/Weaviate.Client.Tests --filter "FullyQualifiedName~Integration"
./ci/stop_weaviate.sh 1.36.9 # stop when done
```

## REST DTO Generation

`src/Weaviate.Client/Rest/Dto/Models.g.cs` is **auto-generated** — never edit it manually. To update it:

1. Run `./tools/openapi_sync.sh` followed by the desired branch or tag to target from the github.com/weaviate/weaviate repo
2. Run `./tools/gen_rest_dto.sh` to regenerate `Models.g.cs` via NSwag

To customize the generated output (e.g., access modifiers), edit the Liquid templates in `src/Weaviate.Client/Rest/Schema/Templates/`. These override NSwag's built-in templates. `File.liquid` overrides the file-level template (controls `FileResponse` visibility, etc.).

## Public API Tracking

After adding public types/members, run:
Expand Down
2 changes: 2 additions & 0 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ services:
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
ENABLE_MODULES: text2vec-transformers,text2vec-cohere,backup-filesystem,generative-dummy,generative-anyscale,reranker-dummy,reranker-cohere,text2vec-ollama,generative-ollama
BACKUP_FILESYSTEM_PATH: "/tmp/backups"
EXPORT_ENABLED: 'true'
EXPORT_DEFAULT_PATH: "/tmp/exports"
CLUSTER_GOSSIP_BIND_PORT: "7100"
CLUSTER_DATA_BIND_PORT: "7101"
CLUSTER_HOSTNAME: "singlenode"
Expand Down
1 change: 0 additions & 1 deletion docs/BATCH_API_USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ The `BatchContext.State` property indicates the current state:
- `Open` - Batch is accepting objects
- `InFlight` - Processing in progress
- `Closed` - Batch completed normally
- `Aborted` - Batch failed with error

## Reference Batching

Expand Down
131 changes: 131 additions & 0 deletions src/Weaviate.Client.Tests/Integration/TestExports.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
namespace Weaviate.Client.Tests.Integration;

using Weaviate.Client.Models;

/// <summary>
/// Integration tests for ExportClient.
/// Requires Weaviate 1.37.0+ with export support enabled.
/// </summary>
[Trait("Category", "Slow")]
[Collection("TestExports")]
[CollectionDefinition("TestExports", DisableParallelization = true)]
public class TestExports : IntegrationTests
{
static readonly BackupBackend _backend = new FilesystemBackend();

public override async ValueTask InitializeAsync()
{
await base.InitializeAsync();

RequireVersion("1.37.0");
}

[Fact]
public async Task CreateSync_CompletesSuccessfully()
{
var ct = TestContext.Current.CancellationToken;
var collection = await CollectionFactory("ExportTest1");

var export = await _weaviate.Export.CreateSync(
new ExportCreateRequest(
$"export-sync-{Guid.NewGuid():N}",
_backend,
IncludeCollections: [collection.Name]
),
timeout: TimeSpan.FromMinutes(2),
cancellationToken: ct
);

Assert.Equal(ExportStatus.Success, export.Status);
Assert.NotNull(export.CompletedAt);
}

[Fact]
public async Task Create_ThenWaitForCompletion()
{
var ct = TestContext.Current.CancellationToken;
var collection = await CollectionFactory("ExportTest2");

await using var operation = await _weaviate.Export.Create(
new ExportCreateRequest(
$"export-async-{Guid.NewGuid():N}",
_backend,
IncludeCollections: [collection.Name]
),
ct
);

Assert.NotNull(operation.Current);

var result = await operation.WaitForCompletion(TimeSpan.FromMinutes(2), ct);

Assert.Equal(ExportStatus.Success, result.Status);
Assert.True(operation.IsCompleted);
Assert.True(operation.IsSuccessful);
}

[Fact]
public async Task GetStatus_ReturnsExportInfo()
{
var ct = TestContext.Current.CancellationToken;
var collection = await CollectionFactory("ExportTest3");
var exportId = $"export-status-{Guid.NewGuid():N}";

await _weaviate.Export.CreateSync(
new ExportCreateRequest(exportId, _backend, IncludeCollections: [collection.Name]),
timeout: TimeSpan.FromMinutes(2),
cancellationToken: ct
);

var status = await _weaviate.Export.GetStatus(_backend, exportId, ct);

Assert.Equal(exportId, status.Id);
Assert.Equal(ExportStatus.Success, status.Status);
}

[Fact]
public async Task Cancel_StopsRunningExport()
{
var ct = TestContext.Current.CancellationToken;
var collection = await CollectionFactory("ExportTest4");

await using var operation = await _weaviate.Export.Create(
new ExportCreateRequest(
$"export-cancel-{Guid.NewGuid():N}",
_backend,
IncludeCollections: [collection.Name]
),
ct
);

// Cancel immediately — may already have completed for small collections.
// Server responds with 409 Conflict when the export has already finished,
// or 404 Not Found if the record is no longer available.
try
{
await _weaviate.Export.Cancel(_backend, operation.Current.Id, ct);
}
catch (WeaviateConflictException)
{
// Export already finished — can't cancel a terminal export.
}
catch (WeaviateNotFoundException)
{
// Export record no longer available.
}

try
{
var status = await _weaviate.Export.GetStatus(_backend, operation.Current.Id, ct);

Assert.True(
status.Status is ExportStatus.Canceled or ExportStatus.Success,
$"Expected Canceled or Success but got {status.Status}"
);
}
catch (WeaviateNotFoundException)
{
// Treat vanished export as successfully canceled.
}
}
}
5 changes: 3 additions & 2 deletions src/Weaviate.Client.Tests/Integration/TestReplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ await op1.WaitForCompletion(
{
await _weaviate.Cluster.Replications.DeleteAll(TestContext.Current.CancellationToken);

// Poll up to 30s for asynchronous deletion to take effect.
// Poll up to 30s for asynchronous deletion to take effect. Operations flagged
// ScheduledForDelete count as deleted — the server clears them on its own cadence.
for (int i = 0; i < 60; i++)
{
var operations = await _weaviate.Cluster.Replications.ListAll(
Expand All @@ -499,7 +500,7 @@ await op1.WaitForCompletion(
Trace.WriteLine(
$"Attempt {attempt + 1}, poll {i}: remaining operations: {operations.Count()}"
);
if (!operations.Any())
if (!operations.Any(o => o.ScheduledForDelete != true))
{
allDeleted = true;
break;
Expand Down
Loading
Loading