@@ -97,9 +97,8 @@ def test_single_volume_mount_is_rw(self, sbx_app):
9797 assert len (spec ["volumes" ]) == 1
9898 vol = spec ["volumes" ][0 ]
9999 assert vol ["name" ] == SHARED_VOLUME_NAME_IN_POD
100- assert vol ["csi" ]["driver" ] == settings .AGENT_SANDBOX_CFS_DRIVER
101- attrs = vol ["csi" ]["volumeAttributes" ]
102- assert set (attrs .keys ()) == {"fsid" , "host" , "path" , "vers" }
100+ assert vol ["csi" ]["driver" ] == settings .AGENT_SANDBOX_VOLUME_CSI_DRIVER
101+ assert vol ["csi" ]["volumeAttributes" ] == dict (settings .AGENT_SANDBOX_VOLUME_CSI_ATTRIBUTES )
103102
104103 mounts = spec ["containers" ][0 ]["volumeMounts" ]
105104 assert mounts == [
@@ -145,11 +144,12 @@ def test_two_volumes_share_single_csi_volume(self, sbx_app):
145144 assert sub_paths == [f"app/{ vid1 .replace ('-' , '' )} " , f"app/{ vid2 .replace ('-' , '' )} " ]
146145
147146 def test_csi_attributes_follow_settings (self , sbx_app , settings ):
148- settings .AGENT_SANDBOX_CFS_DRIVER = "com.example.csi.other"
149- settings .AGENT_SANDBOX_CFS_FSID = "fsid-x"
150- settings .AGENT_SANDBOX_CFS_HOST = "10.0.0.1"
151- settings .AGENT_SANDBOX_CFS_PATH = "/data"
152- settings .AGENT_SANDBOX_CFS_VERS = "4"
147+ # 验证 driver 与 volumeAttributes 完全由 settings 透传,可适配任意 CSI 实现(如 NFS)
148+ settings .AGENT_SANDBOX_VOLUME_CSI_DRIVER = "nfs.csi.k8s.io"
149+ settings .AGENT_SANDBOX_VOLUME_CSI_ATTRIBUTES = {
150+ "server" : "10.0.0.1" ,
151+ "share" : "/data" ,
152+ }
153153
154154 vid = _vol_id ()
155155 sbx = _make_sandbox (
@@ -166,12 +166,10 @@ def test_csi_attributes_follow_settings(self, sbx_app, settings):
166166 spec = AgentSandboxSerializer ._construct_pod_spec (sbx )
167167 csi = spec ["volumes" ][0 ]["csi" ]
168168
169- assert csi ["driver" ] == "com.example. csi.other "
169+ assert csi ["driver" ] == "nfs. csi.k8s.io "
170170 assert csi ["volumeAttributes" ] == {
171- "fsid" : "fsid-x" ,
172- "host" : "10.0.0.1" ,
173- "path" : "/data" ,
174- "vers" : "4" ,
171+ "server" : "10.0.0.1" ,
172+ "share" : "/data" ,
175173 }
176174
177175
0 commit comments