Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set 'currentstep' for PullingBaseImage json event #9844

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/minikube/out/register/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/klog/v2"
)

// If you add a new step here, please also add it to register.Reg registry inside the init() function
const (
InitialSetup RegStep = "Initial Minikube Setup"
SelectingDriver RegStep = "Selecting Driver"
Expand Down Expand Up @@ -69,6 +70,7 @@ func init() {
SelectingDriver,
DownloadingArtifacts,
StartingNode,
PullingBaseImage,
medyagh marked this conversation as resolved.
Show resolved Hide resolved
RunningLocalhost,
LocalOSRelease,
CreatingContainer,
Expand Down
30 changes: 23 additions & 7 deletions test/integration/aaa_download_only_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ limitations under the License.
package integration

import (
"bufio"
"bytes"
"context"
"crypto/md5"
"encoding/json"
"fmt"
"io/ioutil"
"os"
Expand All @@ -41,7 +44,6 @@ func TestDownloadOnly(t *testing.T) {
t.Run(r, func(t *testing.T) {
// Stores the startup run result for later error messages
var rrr *RunResult
var err error

profile := UniqueProfileName(r)
ctx, cancel := context.WithTimeout(context.Background(), Minutes(30))
Expand All @@ -58,18 +60,32 @@ func TestDownloadOnly(t *testing.T) {
defer PostMortemLogs(t, profile)

// --force to avoid uid check
args := append([]string{"start", "--download-only", "-p", profile, "--force", "--alsologtostderr", fmt.Sprintf("--kubernetes-version=%s", v), fmt.Sprintf("--container-runtime=%s", r)}, StartArgs()...)
args := append([]string{"start", "-o=json", "--download-only", "-p", profile, "--force", "--alsologtostderr", fmt.Sprintf("--kubernetes-version=%s", v), fmt.Sprintf("--container-runtime=%s", r)}, StartArgs()...)

// Preserve the initial run-result for debugging
rt, err := Run(t, exec.CommandContext(ctx, Target(), args...))
if rrr == nil {
rrr, err = Run(t, exec.CommandContext(ctx, Target(), args...))
} else {
_, err = Run(t, exec.CommandContext(ctx, Target(), args...))
// Preserve the initial run-result for debugging
rrr = rt
}

if err != nil {
t.Errorf("failed to download only. args: %q %v", args, err)
}
t.Run("check json events", func(t *testing.T) {
s := bufio.NewScanner(bytes.NewReader(rt.Stdout.Bytes()))
for s.Scan() {
var rtObj map[string]interface{}
err = json.Unmarshal(s.Bytes(), &rtObj)
if err != nil {
t.Errorf("failed to parse output: %v", err)
} else if step, ok := rtObj["data"]; ok {
if stepMap, ok := step.(map[string]interface{}); ok {
if stepMap["currentstep"] == "" {
t.Errorf("Empty step number for %v", stepMap["name"])
}
}
}
}
})

// skip for none, as none driver does not have preload feature.
if !NoneDriver() {
Expand Down