Files
seaweedfs/weed/storage/blockvol/csi/identity_test.go
T
Ping QiuandClaude Opus 4.6 5a9a52f2d0 feat: Phase 6 CP6-2 -- CSI control-plane integration + csi-sanity/k3s validation
CP6-2 wires the CSI driver to SeaweedFS master/volume-server control plane:
- Proto: block volume messages in master.proto/volume_server.proto, codegen
- Master registry: in-memory BlockVolumeRegistry with Pending->Active status,
  full/delta heartbeat, inflight lock, placement (fewest volumes)
- VS gRPC: AllocateBlockVolume/DeleteBlockVolume handlers, shared naming
- Master RPCs: CreateBlockVolume (retry up to 3 servers), Delete, Lookup
- Heartbeat: block volume fields wired into bidirectional stream
- CSI Controller: VolumeBackend interface (Local + Master), returns volume_context
- CSI Node: reads volume_context for remote targets, staged map + IQN derivation
- Mode flag: --mode=controller/node/all, --master for control-plane
- K8s manifests: csi-driver.yaml, csi-controller.yaml, csi-node.yaml

csi-sanity conformance (33 pass, 58 skip) found 6 bugs:
- BUG-SANITY-1/2/3: missing VolumeCapabilities/VolumeCapability validation
- BUG-SANITY-4: NodePublish used mount instead of bind mount
- BUG-SANITY-5: NodeUnpublish didn't remove target path
- BUG-SANITY-6: NodeUnpublish failed on unmounted path

k3s Level 4 (PVC->Pod data persistence) found 1 bug:
- BUG-K3S-1: IsLoggedIn didn't handle iscsiadm exit code 21

226 CSI tests + 54 server tests = 280 new tests, all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:01:08 -08:00

52 lines
1.4 KiB
Go

package csi
import (
"context"
"testing"
"github.com/container-storage-interface/spec/lib/go/csi"
)
func TestIdentity_GetPluginInfo(t *testing.T) {
s := &identityServer{}
resp, err := s.GetPluginInfo(context.Background(), &csi.GetPluginInfoRequest{})
if err != nil {
t.Fatalf("GetPluginInfo: %v", err)
}
if resp.Name != DriverName {
t.Fatalf("name: got %q, want %q", resp.Name, DriverName)
}
if resp.VendorVersion != DriverVersion {
t.Fatalf("version: got %q, want %q", resp.VendorVersion, DriverVersion)
}
}
func TestIdentity_GetPluginCapabilities(t *testing.T) {
s := &identityServer{}
resp, err := s.GetPluginCapabilities(context.Background(), &csi.GetPluginCapabilitiesRequest{})
if err != nil {
t.Fatalf("GetPluginCapabilities: %v", err)
}
if len(resp.Capabilities) != 1 {
t.Fatalf("capabilities: got %d, want 1", len(resp.Capabilities))
}
svc := resp.Capabilities[0].GetService()
if svc == nil {
t.Fatal("expected service capability")
}
if svc.Type != csi.PluginCapability_Service_CONTROLLER_SERVICE {
t.Fatalf("capability type: got %v, want CONTROLLER_SERVICE", svc.Type)
}
}
func TestIdentity_Probe(t *testing.T) {
s := &identityServer{}
resp, err := s.Probe(context.Background(), &csi.ProbeRequest{})
if err != nil {
t.Fatalf("Probe: %v", err)
}
if resp.Ready == nil || !resp.Ready.Value {
t.Fatal("expected ready=true")
}
}