-
Notifications
You must be signed in to change notification settings - Fork 364
Closed
Description
Issue
Mysql throws an error while trying to store a string into a varchar column when the string contains emojis. E.G. if you give an app the name 'π¦π¦π¦'.
(You can see the error in the Unit Tests / Test-Mysql checks of this PR #3719 )
Context
This is inconsistent to Postgresql behaviour, Postgresql does not throw an error and stores the name as it is into the ccdb.
The column name
in table apps
is varchar(255)
.
Steps to Reproduce
- Insert into e.g.
spec/request/space_manifests_spec.rb
a test that creates an app with emoji in the app name e.g.
context 'when the manifest contains valid binary-encoded URL(s) for the buildpack(s)' do
let(:app1_model) { VCAP::CloudController::AppModel.make(name: 'π¦π¦π¦', space: space) }
let(:yml_manifest_with_binary_valid_buildpacks) do
"---
applications:
- name: #{app1_model.name}
buildpacks:
- !!binary |-
aHR0cHM6Ly9naXRodWIuY29tL2Nsb3VkZm91bmRyeS9uZ2lueC1idWlsZHBhY2suZ2l0
- !!binary |-
aHR0cHM6Ly9naXRodWIuY29tL2J1aWxkcGFja3MvbXktc3BlY2lhbC1idWlsZHBhY2s="
end
it 'applies the manifest' do
post "/v3/spaces/#{space.guid}/actions/apply_manifest", yml_manifest_with_binary_valid_buildpacks, yml_headers(user_header)
expect(last_response.status).to eq(202)
end
end
- and execute the test against mysql
brew services start mysql
export DB=mysql
export DB_CONNECTION_STRING=mysql2://root:@127.0.0.1:3306/cc_test
bundle exec rake db:create
bundle exec rspec spec/request/space_manifests_spec.rb
Expected result
All tests pass.
Current result
The test with the emojis in the app name fails with following error:
1) Space Manifests POST /v3/spaces/:guid/actions/apply_manifest when the manifest contains valid binary-encoded URL(s) for the buildpack(s) applies the manifest
Failure/Error: buildpack_lifecycle_data { BuildpackLifecycleDataModel.make(app: object.save) }
Sequel::DatabaseError:
Mysql2::Error: Incorrect string value: '\xF0\x9F\xA6\x84\xF0\x9F...' for column 'name' at row 1
# ./spec/support/fakes/blueprints.rb:50:in `block (2 levels) in <module:CloudController>'
# ./spec/support/fakes/blueprints.rb:50:in `block in <module:CloudController>'
# ./spec/request/space_manifests_spec.rb:223:in `block (4 levels) in <top (required)>'
# ./spec/request/space_manifests_spec.rb:20:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:191:in `block (4 levels) in <top (required)>'
# ./spec/support/database_isolation.rb:37:in `cleanly'
# ./spec/spec_helper.rb:191:in `block (3 levels) in <top (required)>'
# /Users/I546390/.rbenv/versions/3.2.3/bin/bundle:25:in `load'
# /Users/I546390/.rbenv/versions/3.2.3/bin/bundle:25:in `<main>'
# ------------------
# --- Caused by: ---
# Mysql2::Error:
# Incorrect string value: '\xF0\x9F\xA6\x84\xF0\x9F...' for column 'name' at row 1
# ./spec/support/fakes/blueprints.rb:50:in `block (2 levels) in <module:CloudController>'
Possible Fix
Suggestion/Question: App naming (or storing any value into a varchar column in the ccdb) should be consistent for Mysql and Postgresql.
Metadata
Metadata
Assignees
Labels
No labels