Commit Graph

27 Commits

Author SHA1 Message Date
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer dbfd4d4de4 RuboCop: Style/TrailingCommaInArguments
[skip-stages=Flakey]

auto-corrected

Change-Id: I042349a67e1473a0db9b07e66e13c149e5c92b55
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278845
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-19 22:22:20 +00:00
Cody Cutrer 42bffa8b21 cdc: improve reliability of fixture creation
Change-Id: I4c458ab1a79ffba18eaec2bf732727f125650d62
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277645
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-08 23:41:05 +00:00
Cody Cutrer 9075b1d8b2 cdc: allow fixtures from plugins
Change-Id: Ife6b1730605f098c2b8d930d5f7b26ea553eb1a9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277642
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-08 23:17:29 +00:00
Cody Cutrer 005b2d283a add file to easily require all the fixtures for CDC tests
Change-Id: Ib882cced423b8696b32a0eba3c5fcde5fea78cc7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277612
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-08 19:53:43 +00:00
Cody Cutrer c65d57737a RuboCop: Layout lib
Change-Id: I0655d9a9d750f2debd6378b03d8ddc1403ebc31b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274158
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-22 20:01:52 +00:00
Jeremy Stanley e46a98e923 create blackout dates
test plan:
 - in console, create blackout_dates on Course and Account contexts
   and ensure associations work
 - ensure start and end dates and the event title are required
   by validation
 - ensure the end date cannot come before the start date

closes LS-2426
flag = none

Change-Id: I480642350c574aead0e66a6fe0fdd7bbb31fdcbf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/272437
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-09-08 15:52:35 +00:00
Cody Cutrer 0e7429b116 actually create the dummy course for course templates
fixes FOO-1962

Change-Id: Ia95ed7df67af812ad63fcd16103cf3c9c157851d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264717
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-05-12 16:45:47 +00:00
Wagner Gonçalves b98393f981 part 3.1: change lookup_id and resource_link_id to UUID datatype
This is part 3.1 of changing the datatype from varchar to UUID of
lookup_id and resource_link_id from lti_resource_links.

Stops writing into lookup_id and resource_link_id columns.

refs INTEROP-6488
flag=none

test-plan:
* specs should pass;
* you should check if LTI is launching as expected, and if the custom
    params was expanded as expected in all records that were created in
    the part 1, 2 and 3;
* you should be able to new persist custom params, for example you can
    use the RCE editor placement;
* you can follow the test-plan:
    * https://gerrit.instructure.com/c/canvas-lms/+/256029
    * https://gerrit.instructure.com/c/canvas-lms/+/254453

Change-Id: I9b2c85e0afb333c17afb1be0fb4a543f145ba400
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258317
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-02-17 18:08:57 +00:00
Wagner Gonçalves e083f3fcd4 part 1: change lookup_id and resource_link_id to UUID datatype
This is part 1 of changing the datatype from varchar to UUID of
lookup_id and resource_link_id from lti_resource_links. We're adding the
new columns lookup_uuid and resource_link_uuid.

refs INTEROP-6488
flag=none

test-plan:
* specs should pass;
* you should check if LTI is launching as expected;
* you should check that the tool is saving the resouce link properly,
  and lookup_uuid should be the same value of lookup_id,
  and resource_link_uuid should be the same value of resource_link_id;
* you can follow the test-plan:
  * https://gerrit.instructure.com/c/canvas-lms/+/256029
  * https://gerrit.instructure.com/c/canvas-lms/+/254453

Change-Id: Ie19b64e48cb407e53459c26d901f9e922e548d65
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257852
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-02-05 16:55:29 +00:00
Tucker McKnight f509dd6bb4 spec: Add the required 'queue' column to job fixture
Change-Id: I9fbaebbb84e62c3791a60abf89da151df3d9fafd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256461
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2021-01-12 18:14:13 +00:00
Tucker McKnight 43982889b5 spec: Manually create a delayed job in a fixture file
Having a delayed job with an id of 1 causes a conflict later when
inst-jobs automatically creates a job also with an id of 1. As a
workaround, manually create one with an id of 2.

fixes INTEROP-6439

Change-Id: I3a8842bf0073972293cc83c3bfd263ab1fa57053
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256383
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-01-11 19:08:28 +00:00
Tucker McKnight 40955fd02f spec: Add root_account_id to web_conference fixture
The web_conference table has a root_account_id on it in prod now.

Change-Id: Ieea0b1873f0ed36a08886918837c732af2d6a4c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256117
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2021-01-06 21:18:36 +00:00
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-27 20:49:50 +00:00
Tucker McKnight f9fa2d57a0 spec: Throw a ForeignKeyNotSatisfied if an assignment doesn't exist
When creating an AssignmentOverride for the CDC schema tests,
it currently fills in 1 for assignment_id.

Any required integer field is auto-filled with a 1, so we're
assuming that an assignment exists with an ID of 1. This isn't
a safe assumption, so look for an actual assignment instead, and
throw a ForeignKeyNotSatisfied error if there isn't one yet.

(ForeignKeyNotSatisfied will push this model to the back of the queue
and try to create it later, after other models have been created.)

Change-Id: I6dea6e5e6e0c553a3ba261f47565fc1dda95ce7f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248890
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-09-30 18:48:22 +00:00
Tucker McKnight 4f1cde8964 Remove ModelGenerator class and rake task
This is in a separate repository (model-generator) now.

Change-Id: I5974799efe41d44b624dc037991d684e1c64a26e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/237022
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jeremy Slade <jslade@instructure.com>
Reviewed-by: Jeremy Slade <jslade@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-05-15 17:46:07 +00:00
Tucker McKnight 53dc70e404 spec: Set empty settings hash when creating a PluginSetting
Plugin.enabled? will return false if the PluginSetting has an
empty settings hash, even if PluginSetting.disabled is false.

A conference-type plugin needs to be enabled before a WebConference
can be created. And a WebConference needs to be created to test
the web_conferences table in the CDC build.

test plan:
- RAILS_ENV=test bundle exec rake db:test:fill_tables does not error

refs PLAT-5394

Change-Id: Ia4d1b762a3f1427e3c2378cadd4d4d1a9d0899cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229736
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-04-21 21:02:44 +00:00
Tucker McKnight 75bef1aa5b Better info and error logging for CDC model generation
refs PLAT-5361

Change-Id: I897feed44128bf4936f5bcad5c56432ca2ea7f41
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228704
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:58:15 +00:00
Tucker McKnight a266edc7a6 Eager_load all models when CDC testing
Many models are missed if you don't eager_load first.

refs PLAT-5361

Change-Id: Ia3fb2ec93251b6be08779c9dc1570221e0e95b6d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228703
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:57:57 +00:00
Tucker McKnight e533abbea1 Manually create a WebConference when CDC testing
WebConference has a self.conference_type= method, giving it
some custom logic when setting a conference_type value that
can't be skipped by ignoring validations and callbacks.

refs PLAT-5361

Change-Id: Ie6b645f9a4f8afb24b199dd79d0c332f5297227d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228702
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:57:35 +00:00
Tucker McKnight eb792fb9e4 Respect char limit when filling columns in CDC testing
Instead of just "default," a string of a's will be used.
It'll be either 8 characters or the column limit, whichever
is fewer.

PLAT-5361

Change-Id: I30ee99e50dd334aa750c917ed7f76bd68add1b64
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228701
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:57:14 +00:00
Tucker McKnight 8842ced941 Fill in class names for polymorphic relations in CDC testing
Change the find_partman_columns method to only return the
relation name (foo) rather than the column name (foo_id), since
we want to fill in both foo_id and foo_type now.

The polymorphic_class_name method looks at the polymorphic
assiciations on the model to find a valid class name to fill in
for foo_type.

refs PLAT-5361

Change-Id: I1ca21fe19228bcf2584aa55ed2979d782cf055e3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228700
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:56:52 +00:00
Tucker McKnight 394ef3fd3f Autofill 'type' column for CDC testing
If a model has a 'type' attribute, ActiveRecord expects
that value to be the name of a class that extends the
model. It can be safely auto-filled with the name of
any class that extends the given model.

refs PLAT-5361

Change-Id: I2251db6647551131bdacdea90b596de14b80c59d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228699
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:56:24 +00:00
Tucker McKnight 127f587e00 Add more autofillable column types for CDC testing
Fill in column values for decimal, float, and jsonb colums,
and serialized Objects.

refs PLAT-5361

Change-Id: I878b5118d87d7a24cecafea4f45b3168566242bf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228698
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:56:06 +00:00
Tucker McKnight 0bc5842c3d Use ActiveRecord's has_table? method
This is more reliable than what was being done before.

We have a Tableless model that is extended by some of
our other models; Tableless overrides the `columns`
method to return a value even though it doesn't have a table.

refs PLAT-5361

Change-Id: Ib0c2e6c9af6dd194246ef8f9f9711fc3e2b9082a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228697
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:55:46 +00:00
Tucker McKnight 262218444c spec: tests for the ModelGenerator
refs PLAT-5361

Change-Id: I91fdaedcadb8583c08a486ad37b9fc37eccc589b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228129
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:55:23 +00:00
Tucker McKnight ecf0b41dbe Add a rake task that inserts rows into all db tables
This will generate models that are "valid enough" to be inserted
into the database. The aren't entirely valid models -- it skips
any ActiveRecord validations before saving. But they do satisfy
the column types and constraints that Postgres has, which is enough
to trigger CDC events.

test plan:
- Have an empty test database (RAILS_ENV=test rake db:reset)
- Run RAILS_ENV=test rake db:test:fill_tables
- There should be at least one row in each table in your test database

flag = none

refs PLAT-5361

Change-Id: I6a2761a2f44f2b4fe69182b971c5a5d5b5139512
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/227959
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-03-10 22:54:50 +00:00