Strip rspec-profiling output of NULL bytes
If a spec such as spec/lib/banzai/pipeline/wiki_pipeline_spec.rb included a NULL byte in the example text, then the
insert-rspec-profiling-data script would fail with the error (e.g. https://gitlab.com/gitlab-org/gitlab/-/jobs/386527522):
/usr/local/bundle/gems/pg-1.1.4/lib/pg/connection.rb:173:in `get_last_result': ERROR: invalid byte sequence for encoding "UTF8": 0x00 (PG::CharacterNotInRepertoire)
CONTEXT: COPY spec_profiling_results, line 764
from /usr/local/bundle/gems/pg-1.1.4/lib/pg/connection.rb:173:in `copy_data'
from /usr/local/bundle/gems/postgres-copy-1.4.1/lib/postgres-copy/acts_as_copy_target.rb:103:in `copy_from'
from scripts/insert-rspec-profiling-data:38:in `block in insert_data'
from scripts/insert-rspec-profiling-data:36:in `each'
from scripts/insert-rspec-profiling-data:36:in `insert_data'
from scripts/insert-rspec-profiling-data:43:in `<main>'
To avoid this, we do two things:
- Drop the NULL byte from the example test.
- Modify the
insert-rspec-profiling-datascript to sanitize the CSV.
Closes #120012 (closed)
Edited by Stan Hu