Skip to content

Commit

Permalink
chore: applied feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-esk committed Aug 23, 2024
1 parent 0738e4f commit c8fc8c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ And some more real-world examples can be found in the following repositories:

### Running Tests

You can use the built-in `go test` command to run the tests.
Depending on how you write your tests, you can use the built-in `go test` command to run the tests.

To run all tests in the current directory, you can run:

```shell
go test -v ./... -timeout=<timeout>m
```

**Note:** The timeout is set to 10 minutes by default. Make sure to set a timeout that is long enough to complete the test.
**Note 1:** The timeout is set to 10 minutes by default. Make sure to set a timeout that is long enough to complete the test.
**Note 2:** Please note that the timeout flag in the example is the go test timeout and not related to the knuu timeout.

#### Environment Variables

Expand Down
10 changes: 6 additions & 4 deletions docs/knuu-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func main() {

options := knuu.Options{
Scope: "example-scope",
Timeout: 30 * time.Minute,
Timeout: 30 * time.Minute, // This is an internal timeout for the knuu object to clean up the resources if the program exits unexpectedly
Logger: logrus.New().WithLevel(logrus.ErrorLevel),
}

Expand All @@ -72,11 +72,13 @@ func main() {
}()


sampleInstance, err := kn.NewInstance("alpine")
sampleInstance, err := kn.NewInstance("my-builder-instance")
if err != nil {
log.Fatalf("Failed to create instance: %v", err)
}

// When using a git repo as the builder, the repo is cloned to the builder container and the build is done inside the container
// It is expected to have a Dockerfile in the root of the repo
err = sampleInstance.Build().SetGitRepo(ctx, builder.GitContext{
Repo: "https://github.com/<sample-repo>.git",
Branch: "<desired-branch>",
Expand All @@ -88,7 +90,7 @@ func main() {
}

// optionally can set image directly instead of building from git repo
// err = sampleInstance.Build().SetImage(ctx, "docker.io/alpine:latest")
// err = sampleInstance.Build().SetImage(ctx, "docker.io/<example-image>:<tag>")
// if err != nil {
// log.Fatalf("Failed to set image: %v", err)
// }
Expand Down Expand Up @@ -116,7 +118,7 @@ func main() {
}

// Adding file after commit will add it to the deployment of the instance
// Therefore the is no image rebuilt, however the file must be very small (config maps are used)
// Therefore the is no image rebuilt, however the file must be very small (config maps are used, so a few KBs are fine)
// and should not be used to transport large files otherwise the deployment will fail
err = sampleInstance.Storage().AddFile("<source-path>", "<destination-path>", "<permissions>")
if err != nil {
Expand Down

0 comments on commit c8fc8c6

Please sign in to comment.