Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible for code to change without Git knowing about it?

This morning I ran my tests and there are 2 failures. But I haven't changed any code for a few days and all tests were passing.

According to Git, there are no changes (except for coverage.data, which is the test output). gitk shows no other changes.

How does Git know when code changes? Could this be caused by an SSD failure/error?

What is the best way to figure out what happened?

EDIT: Working in Ruby on Rails with Unit Test framework.

like image 556
B Seven Avatar asked Oct 31 '11 15:10

B Seven


2 Answers

I'd start by figuring out why the tests failed, and that might give you some clues as to how they might have passed before. Sometimes it's a timing issue, intermittent failure, something external to the test harness, data changing, a change of date or time, all sorts of stuff.

like image 78
Mike Christensen Avatar answered Sep 25 '22 07:09

Mike Christensen


I see Mike found your problem (ticky the little answer box please).

Yes, it is possible for code to change without Git knowing about it. The file which caused the failure, perhaps a temporary testing file or fixture, could be ignored either in .gitignore or .git/info/exclude. Doing a git clean -dxf will wipe the checkout clean of anything not known to git. git status --ignored will show the files ignored by git. If that's the case, you want to add better test cleanup as part of your test runner.

For posterity, here's the short list of ways tests could fail without there being any code change visible to git:

  • "Temporary" test files and fixtures might be dirty.
  • "Temporary" databases and tables might be dirty.
  • It is sensitive to time or date.
  • It uses network resources and they changed.
  • The compiler was changed.
  • The installed libraries used were changed.
    • The libraries the libraries use were changed.
  • The kernel was changed.
  • Any servers used (databases, web servers, etc...) were changed.
  • It uses parallel processing and a subtle bug only occurs sometimes.
  • The disk (or the filesystem where temp files go) is full.
  • The disk (or the filesystem where temp files go) is broken.
  • Your memory/disk/process/filehandle quotas were reduced.
  • The machine has run out of memory.
  • The machine has run out of filehandles.
  • It uses fixtures with randomly generated data and generated some that tickled a bug.
like image 45
Schwern Avatar answered Sep 23 '22 07:09

Schwern