(imageSelector string, namespace string, filePath string)
| 132 | } |
| 133 | |
| 134 | func ExpectRemoteFileNotFound(imageSelector string, namespace string, filePath string) { |
| 135 | kubeClient, err := kube.NewKubeHelper() |
| 136 | ExpectNoErrorWithOffset(1, err) |
| 137 | |
| 138 | fileExists := "file exists" |
| 139 | fileNotFound := "file not found" |
| 140 | err = wait.PollUntilContextTimeout(context.TODO(), time.Second, time.Minute*2, true, func(_ context.Context) (done bool, err error) { |
| 141 | test := []string{"sh", "-c", fmt.Sprintf("test -e %s && echo %s || echo %s", filePath, fileExists, fileNotFound)} |
| 142 | out, err := kubeClient.ExecByImageSelector(imageSelector, namespace, test) |
| 143 | if err != nil { |
| 144 | return false, err |
| 145 | } |
| 146 | |
| 147 | out = strings.Trim(out, "\n") |
| 148 | |
| 149 | if out == fileExists { |
| 150 | return false, errors.New("file should not exist") |
| 151 | } |
| 152 | |
| 153 | return out == fileNotFound, nil |
| 154 | }) |
| 155 | ExpectNoErrorWithOffset(1, err) |
| 156 | } |
| 157 | |
| 158 | func ExpectRemoteContainerFileContents(labelSelector, container string, namespace string, filePath string, contents string) { |
| 159 | kubeClient, err := kube.NewKubeHelper() |
no test coverage detected