You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/07/12 07:43:08 UTC

[camel-k] 01/02: fix(ci): flaky unit test

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 2c52dd3453c3949a1bd6b41c4fabf86b58941831
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Tue Jul 11 13:11:22 2023 +0200

    fix(ci): flaky unit test
---
 .github/workflows/coverage-report.yml | 8 ++++----
 pkg/cmd/source/util_test.go           | 3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml
index 96371e955..f87fb187f 100644
--- a/.github/workflows/coverage-report.yml
+++ b/.github/workflows/coverage-report.yml
@@ -12,7 +12,7 @@
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
-# limitations under the License. 
+# limitations under the License.
 # ---------------------------------------------------------------------------
 # test
 name: coverage-report
@@ -67,18 +67,18 @@ jobs:
 
           new_coverage="$(grep -o -P '(?<=\(statements\))(.+)(?=%)' coverage.out | xargs)"
           echo "NEW_COV=$new_coverage" >> $GITHUB_ENV
-          
+
           coverage_difference=`echo "$new_coverage-${{env.OLD_COV}}" | bc`
           echo "COV_DIFF=$coverage_difference" >> $GITHUB_ENV
 
           if (( $(echo "$coverage_difference > 0" |bc -l) )); then
-          echo "POS_DIFF=POS" >> $GITHUB_ENV  
+          echo "POS_DIFF=POS" >> $GITHUB_ENV
           elif (( $(echo "$coverage_difference < 0" |bc -l) )); then
           echo "POS_DIFF=NEG" >> $GITHUB_ENV
           else
           echo "POS_DIFF=ZERO" >> $GITHUB_ENV
           fi
-         
+
       - name: Save env variables
         run: |
           mkdir -p ./pr
diff --git a/pkg/cmd/source/util_test.go b/pkg/cmd/source/util_test.go
index 586743d2b..d04e8fd25 100644
--- a/pkg/cmd/source/util_test.go
+++ b/pkg/cmd/source/util_test.go
@@ -45,13 +45,12 @@ func isWindows() bool {
 }
 
 func TestPermissionDenied(t *testing.T) {
-	dir := "/tmp/filedir"
 
 	if isWindows() {
 		t.Skip("Test not reliably producing a result on a windows OS")
 	}
 
-	err := os.Mkdir(dir, 0700)
+	dir, err := os.MkdirTemp("/tmp", "camel-k-")
 	assert.Nil(t, err)
 
 	filename := filepath.Join(dir, "file.txt")