zaquestion / lab

Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab
https://zaquestion.github.io/lab
Creative Commons Zero v1.0 Universal
1.1k stars 103 forks source link

project_create_test: fix negative sign on testdata dir name #826

Closed bmeneg closed 2 years ago

bmeneg commented 2 years ago

A random usigned interger is used for generating the testdata directory name, but an int() casting is done right after and, because of that, depending on the size of the generated uint, the int casting will make it a negative number. Consequently, the negative sign is maintained in the resulting string from the strconv.Itoa() conversion, leading to a directory name with two dashes: "testdata--8339364144815363225".

Even though this name format isn't a problem to lab itself, it's used as "project name" for the project_create command testing code, which isn't supported by GitLab:

ERROR: project_create.go:94: POST https://gitlab.com/api/v4/projects: 400 {message: {path: [must not start or end with a special character and must not contain consecutive special characters.]}}

This patch format the random uint directly to string without using the intermediate int() casting.

Signed-off-by: Bruno Meneguele bmeneg@redhat.com

codecov[bot] commented 2 years ago

Codecov Report

Merging #826 (667d16d) into master (73bada2) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #826   +/-   ##
=======================================
  Coverage   56.30%   56.30%           
=======================================
  Files          77       77           
  Lines        5760     5760           
=======================================
  Hits         3243     3243           
  Misses       2227     2227           
  Partials      290      290           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 73bada2...667d16d. Read the comment docs.