-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(volumes): some fixes and cleanups (#359)
* fix(volumes): some fixes and cleanups Signed-off-by: Jose Ramon Mañes <jose@celestia.org> * fix(volumes): fix TestNoVolumesOneFile Signed-off-by: Jose Ramon Mañes <jose@celestia.org> * fix(volumes): cleanup Signed-off-by: Jose Ramon Mañes <jose@celestia.org> * fix(comments): add assert func Signed-off-by: Jose Ramon Mañes <jose@celestia.org> * fix(comments): use assert func Signed-off-by: Jose Ramon Mañes <jose@celestia.org> * fix(comments): vim typo Signed-off-by: Jose Ramon Mañes <jose@celestia.org> --------- Signed-off-by: Jose Ramon Mañes <jose@celestia.org>
- Loading branch information
Showing
7 changed files
with
61 additions
and
154 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package basic | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/celestiaorg/knuu/pkg/knuu" | ||
) | ||
|
||
const ( | ||
// nginxImage is the image used to create the instances. | ||
nginxImage = "docker.io/nginx:latest" | ||
// nginxVolume is the volume used to create the instances. | ||
nginxVolume = "1Gi" | ||
// nginxVolumeOwner is the owner of the volume used to create the instances. | ||
nginxVolumeOwner = 0 | ||
// nginxPort is the port used to create the instances. | ||
nginxPort = 80 | ||
// nginxPath is the path used to create the instances. | ||
nginxPath = "/usr/share/nginx/html" | ||
) | ||
|
||
// assertCreateInstanceNginxWithVolumeOwner creates and configures an instance with common settings used across tests. | ||
func assertCreateInstanceNginxWithVolumeOwner(t *testing.T, instanceName string) *knuu.Instance { | ||
instance, err := knuu.NewInstance(instanceName) | ||
if err != nil { | ||
t.Fatalf("Error creating instance '%v': %v", instanceName, err) | ||
} | ||
err = instance.SetImage(nginxImage) | ||
if err != nil { | ||
t.Fatalf("Error setting image for '%v': %v", instanceName, err) | ||
} | ||
err = instance.AddPortTCP(nginxPort) | ||
if err != nil { | ||
t.Fatalf("Error adding port for '%v': %v", instanceName, err) | ||
} | ||
_, err = instance.ExecuteCommand("mkdir", "-p", nginxPath) | ||
if err != nil { | ||
t.Fatalf("Error executing command for '%v': %v", instanceName, err) | ||
} | ||
err = instance.AddVolumeWithOwner(nginxPath, nginxVolume, nginxVolumeOwner) | ||
if err != nil { | ||
t.Fatalf("Error adding volume: %v", err) | ||
} | ||
err = instance.Commit() | ||
if err != nil { | ||
t.Fatalf("Error committing instance '%v': %v", instanceName, err) | ||
} | ||
return instance | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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