Skip to content

Commit

Permalink
fix: prevent duplicate persistent attribute when using ram storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x committed May 3, 2024
1 parent 7de1540 commit 6a821ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sdl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class SDL {

const pairs = Object.keys(attributes).map(key => ({ key, value: attributes[key].toString() }));

if (attributes.class === "ram" && !attributes.persistent) {
if (attributes.class === "ram" && !("persistent" in attributes)) {
pairs.push({ key: "persistent", value: "false" });
}

Expand Down
16 changes: 16 additions & 0 deletions tests/__snapshots__/sdl_persistent_storage_attributes.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,22 @@ exports[`test sdl persistent storage SDL: Persistent Storage Manifest: SDL: Pers
"val": 1073741824,
},
},
{
"attributes": [
{
"key": "class",
"value": "ram",
},
{
"key": "persistent",
"value": "false",
},
],
"name": "shm2",
"size": {
"val": 1073741824,
},
},
],
},
"params": {
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/persistent_storage_valid.sdl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ profiles:
size: 1Gi
attributes:
class: ram
- name: shm2
size: 1Gi
attributes:
class: ram
persistent: false
placement:
akash:
#######################################################
Expand Down

0 comments on commit 6a821ef

Please sign in to comment.