FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support propagation modes rslave, rshared and rprivate in Bind.parse by cgoeller · Pull Request #2519 · docker-java/docker-java · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
    • Bind.java
    • BindTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,16 @@ public static Bind parse(String serialized) {
nocopy = true;
} else if (PropagationMode.SHARED.toString().equals(p)) {
propagationMode = PropagationMode.SHARED;
} else if (PropagationMode.RSHARED.toString().equals(p)) {
propagationMode = PropagationMode.RSHARED;
} else if (PropagationMode.SLAVE.toString().equals(p)) {
propagationMode = PropagationMode.SLAVE;
} else if (PropagationMode.RSLAVE.toString().equals(p)) {
propagationMode = PropagationMode.RSLAVE;
} else if (PropagationMode.PRIVATE.toString().equals(p)) {
propagationMode = PropagationMode.PRIVATE;
} else if (PropagationMode.RPRIVATE.toString().equals(p)) {
propagationMode = PropagationMode.RPRIVATE;
} else {
seMode = SELContext.fromString(p);
}
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ public void parseReadWriteShared() {
assertThat(bind.getPropagationMode(), is(PropagationMode.SHARED));
}

@Test
public void parseReadWriteRshared() {
Bind bind = Bind.parse("/host:/container:rw,rshared");
assertThat(bind.getPath(), is("/host"));
assertThat(bind.getVolume().getPath(), is("/container"));
assertThat(bind.getAccessMode(), is(rw));
assertThat(bind.getSecMode(), is(SELContext.none));
assertThat(bind.getNoCopy(), nullValue());
assertThat(bind.getPropagationMode(), is(PropagationMode.RSHARED));
}

@Test
public void parseReadWriteSlave() {
Bind bind = Bind.parse("/host:/container:rw,slave");
Expand All @@ -177,6 +188,17 @@ public void parseReadWriteSlave() {
assertThat(bind.getPropagationMode(), is(PropagationMode.SLAVE));
}

@Test
public void parseReadWriteRslave() {
Bind bind = Bind.parse("/host:/container:rw,rslave");
assertThat(bind.getPath(), is("/host"));
assertThat(bind.getVolume().getPath(), is("/container"));
assertThat(bind.getAccessMode(), is(rw));
assertThat(bind.getSecMode(), is(SELContext.none));
assertThat(bind.getNoCopy(), nullValue());
assertThat(bind.getPropagationMode(), is(PropagationMode.RSLAVE));
}

@Test
public void parseReadWritePrivate() {
Bind bind = Bind.parse("/host:/container:rw,private");
Expand All @@ -188,6 +210,17 @@ public void parseReadWritePrivate() {
assertThat(bind.getPropagationMode(), is(PropagationMode.PRIVATE));
}

@Test
public void parseReadWriteRprivate() {
Bind bind = Bind.parse("/host:/container:rw,rprivate");
assertThat(bind.getPath(), is("/host"));
assertThat(bind.getVolume().getPath(), is("/container"));
assertThat(bind.getAccessMode(), is(rw));
assertThat(bind.getSecMode(), is(SELContext.none));
assertThat(bind.getNoCopy(), nullValue());
assertThat(bind.getPropagationMode(), is(PropagationMode.RPRIVATE));
}

@Test
public void parseReadOnly() {
Bind bind = Bind.parse("/host:/container:ro");
Expand Down Expand Up @@ -284,16 +317,31 @@ public void toStringReadWriteShared() {
assertThat(Bind.parse("/host:/container:rw,shared").toString(), is("/host:/container:rw,shared"));
}

@Test
public void toStringReadWriteRshared() {
assertThat(Bind.parse("/host:/container:rw,rshared").toString(), is("/host:/container:rw,rshared"));
}

@Test
public void toStringReadWriteSlave() {
assertThat(Bind.parse("/host:/container:rw,slave").toString(), is("/host:/container:rw,slave"));
}

@Test
public void toStringReadWriteRslave() {
assertThat(Bind.parse("/host:/container:rw,rslave").toString(), is("/host:/container:rw,rslave"));
}

@Test
public void toStringReadWritePrivate() {
assertThat(Bind.parse("/host:/container:rw,private").toString(), is("/host:/container:rw,private"));
}

@Test
public void toStringReadWriteRprivate() {
assertThat(Bind.parse("/host:/container:rw,rprivate").toString(), is("/host:/container:rw,rprivate"));
}

@Test
public void toStringDefaultAccessMode() {
assertThat(Bind.parse("/host:/container").toString(), is("/host:/container:rw"));
Expand Down

Back | FazBrowse Home | New Git URL