Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EvmDatabaseOps] Fix .validate_free_space target
Currently, `db_opts[:local_file]` will always be a FIFO with the new file_storage mechanisms, so `.validate_free_space` will only check against the tmp dir, which usually isn't very large and not the target destination for the DB backup/dump. This fix moves the check to a place were we can get access to the file_storage object directly and target the directory of the mounted filesystem that will receive the backup/dump. To that end, the check now only applies to file storage classes that are "mountable", since checking against non-mountable storages don't make sense (s3/swift don't have this capability, and they are assumed to be "infinite" anyway, and I don't think you can query FTP for available storage as well so I think the same assumption is also fair to apply) * * * Quick note: In a couple of spots in the tests, the following is added: allow(file_storage).to receive(:class).and_return(MiqSmbSession) Despite `file_storage` being defined above with: let(:file_storage) { double("MiqSmbSession", :disconnect => nil) } This is now required after moving validate_free_space to inside the with_file_storage method, and wrapping it in a class check of: if file_storage.class <= MiqGenericMountSession This "stubs the stub" to have it act like a MiqSmbSession, when in fact, it isn't. Unfortunately, this can't be used globally since it causes a bunch of other tests failures.
- Loading branch information